Python os.getsid() Method
Example
Print the session id of current process:
#Import os Library
import os
#get the current process id
pid = os.getpid()
#print the sesion id of current process
print (os.getsid(pid))
Try it Yourself »
Definition and Usage
The os.getsid() method returns the session id of a process.
Note: Only available on UNIX platform.
Syntax
os.getsid(pid)
Parameter Values
| Parameter | Description |
|---|---|
| pid | Required. Specifies a process id to find the session id of |
Technical Details
| Return Value: | An int value, representing the session
id of the associated process id |
|---|---|
| Python Version: | pre-2.6 |