Python Module Name:
os
Method Name:
os.get_exec_path
Method Signature:
os.get_exec_path(env=None)
Method Parameters:
env - The environment variables as a Python dictionary. The default value is None.
Return Value:
Returns a Python list of strings. Each string represents a path.
Method Overview:
- The method get_exec_path() of os module in Python returns a list of paths used to search for an executable while launching a process.
- The method can be passed of any set of environment variables as a python dictionary to find the paths.
Example:
# import the Python os module import os
# Get the list of paths pathList = os.get_exec_path()
print("List of paths to search for while launching a process:") print("------------------------------------------------------") for path in pathList: print(path) |
Output:
List of paths to search for while launching a process: ------------------------------------------------------ /Library/Frameworks/Python.framework/Versions/3.7/bin /Library/Frameworks/Python.framework/Versions/3.6/bin /Library/Frameworks/Python.framework/Versions/3.5/bin /Library/Frameworks/Python.framework/Versions/3.5/bin /Library/Frameworks/Python.framework/Versions/3.4/bin /usr/local/mysql/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /Applications/Postgres.app/Contents/Versions/latest/bin |