Get process ID with python

How to get the current process id with python on windows?

there are this function os.geteuid() but its only works with linux/unix could someone tell what it the pythonic way to get the current process id on windows.

1 Answer

Do you really want the process ID? Then the answer is this:

>>> import os
>>> os.getpid()
5328

on either Windows or Unix (documentation of os.getpid).

os.geteuid() doesn't get the process ID, which makes me wonder whether you're really asking a different question...?

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like