win32all: set process title

Oleg Broytmann phd at
Mon Apr 10 10:51:58 CEST 2000


   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 some time

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)
   raise NotImplementedError("Your platform is not supported")

    Oleg Broytmann    phd2 at
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-list mailing list