0

I have a path where I have many executables (around 800). I need to know if some of those executables are running. This is because I need to run a build and if the executables are running I cannot recreate them (access error when linker is invoked).

What I do currently is to run taskkill (I am on Windows platform) on all those executables. This takes time and I'd like to know if there's a faster/better way.

The build scripts are written in python but other solutions are welcome if we can easily integrate them.

Iulian

INS
  • 10,594
  • 7
  • 58
  • 89
  • possible duplicate of [Python, List running processes 64Bit Windows](http://stackoverflow.com/questions/1632234/python-list-running-processes-64bit-windows) or http://stackoverflow.com/questions/2084111/windows-process-management-using-python – David Heffernan May 13 '13 at 09:35

1 Answers1

0

For similar purposes I have used psutil library. Some hints:

  • list processes with psutil.pids() (reference)
  • inspect process information with process = psutil.Process(pid) (reference)
  • do process.kill or process.terminate()

Installation on windows - pip will do installation from the source (which means compiling), so you probably want to download binary installation from https://pypi.python.org/pypi/psutil/#downloads.

Robert Lujo
  • 15,383
  • 5
  • 56
  • 73