[Tutor] application name of a process

D-Man dsh8290@rit.edu
Thu, 2 Nov 2000 20:06:03 -0500


If you're talking about the name of the running process, sys.argv[0] would do it.

If you're talking about other processes,  I don't know.  Check the source for 'ps' ;-).  You can probably get it out of /proc if you're on a Linux (I don't know about other unices) system.

-D


On Thu, 02 Nov 2000 11:00:00 Gianmarco Baronio wrote:
 | Hello everybody,
 | I'm working with Pythonwin.
 | I know the PID associated with my process in this way:
 | 
 | >>> import os
 | >>> PID = os.getpid()
 | 
 | How can I have the name of the application associated with a process if
 | I know the PID?
 | 
 | Thanks
 | 
 | begin:vcard 
 | n:Baronio;Gianmarco
 | tel;fax:+39 030 2209205
 | tel;work:+39 030 24411
 | x-mozilla-html:TRUE
 | org:<CENTER><B><I><FONT FACE="Arial,Helvetica" COLOR="#000000" SIZE="+2">Siosistemi</FONT></I></B><HR WIDTH="30%" NOSHADE SIZE=1><FONT FACE="Times" SIZE="-3">CONNECTING BUSINESS</FONT></CENTER>
 | version:2.1
 | email;internet:gbaronio@siosistemi.it
 | adr;quoted-printable:;;via Cefalonia 58=0D=0A25124 Brescia;Brescia;BS;25124;Italy
 | fn:Gianmarco Baronio
 | end:vcard
 |