Prev: Windows: How to detect whether a Python app/script is runningin console/GUI mode?
Next: suitable py2app.
From: Emile van Sebille on 27 Jul 2010 11:42 On 7/27/2010 7:36 AM python(a)bdurham.com said... > Windows: How can I detect whether a Python app/script is running > in console/GUI mode? By app I mean a script compiled to an exe > via py2exe or similar. > Once you've got an exe, you'll need to know the name you're looking for. There are several utilities available -- I use pslist from sysinternals, but there are others out there like process explorer, WMIC or tasklist. You could translate the VB found at http://support.microsoft.com/kb/187913 and use win32. You could program a pid file into your exe and check that. One cheap trick is to create a file and keep it open while your process runs. From the outside, if the file is missing or you can erase the file, you're process isn't active. This relies on windows requiring exclusive access to delete a file which it does, and doesn't rely on the presence of a particular windows version or installation of a third party utility. HTH, Emile |