win32all: set process title

Oleg Broytmann phd at phd.russ.ru
Mon Apr 10 04:51:58 EDT 2000


Hello!

   I am working an a module to set process name (title) in the output of
"ps" command. It is UNIX-only module, of course.
   I want to provide some portability, if at all possible, but do not know
anything about modern Windows and Python for Win (I departed from
DOS/Windows 3.1 world many yeras ago :)

   Can you help me? Could you please send me a snippet of code and a list
of platforms - how I can set process name (some comments on how user can
look at process name will be good accessories :)
   Something like this (I rememeber seeing such code in c.l.py some time
ago):

import sys
if sys.platform == "posix": # Oops, wrong test, DJGPP-compiled DOS port is "posix", too :/
   from setproctitle import setproctitle
elif sys.platform in ("nt", "md95"):
   from win32all import CurProc, SetProcessName
   def setproctitle(title):
      SetProcessName(CurProc(), title)
else:
   raise NotImplementedError("Your platform is not supported")

Oleg.
---- 
    Oleg Broytmann    http://members.xoom.com/phd2.1/    phd2 at earthling.net
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list