get process id...

Tim Golden tjgolden at gmail.com
Thu Sep 21 04:01:46 EDT 2006


billie wrote:
> georgeryoung at gmail.com ha scritto:
>
> > SpreadTooThin wrote:
> > > How does one get the process id?
> > > Is there a method for windows and unix (mac os x etc...)
> >
> > under linux, do:
> >   import os
> >   os.getpid()
>
> Under Windows:
> import ctypes
> ctypes.windll.kernel32.GetCurrentProcessId()

Anything wrong with os.getpid () under Windows, too?

<dump>
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getpid ()
3504
>>>
</dump>

TJG




More information about the Python-list mailing list