OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
All functions in os module raise OSError in the case of invalid or inaccessible file names and paths, or other arguments that have the correct type, but are not accepted by the operating system.
os.get_exec_path() method in Python is used to get the list of directories that will be searched for a named executable while launching a process.
Syntax: os.get_exec_path(env = None)
env (optional): A dictionary representing the environment variables. The default value of this parameter is None. If its value is None environ is used.
Return Type: This method returns a list which represents the paths of directories that will be used to search a named executable while launching a process.
Following paths will be searched for a named executable: ['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', '/snap/bin', '/usr/local/java/jdk-10.0.1/bin', '/usr/local/java/jdk-10.0.1/jre/bin', '/opt/jdk-10.0.1/bin', '/opt/jdk-10.0.1/jre/bin']
Code #2: Specifying env parameter
Following paths will be searched for a named executable: ['', '/bin', '/usr/bin']
- Difference between Method Overloading and Method Overriding in Python
- class method vs static method in Python
- Python | set() method
- Python | next() method
- Python | os.dup() method
- Python | PyTorch sin() method
- Python | os.nice() method
- Python | os.fstatvfs() method
- turtle.up() method in Python
- Python | os.fork() method
- Python | Tensorflow sin() method
- Python | os.getpgrp() method
- Python | os.pwrite() method
- Python | os.setregid() method
- Python | os.getsid() method
- Python | os.getgrouplist() method
- Python | iter() method
- Python | Tensorflow log() method
- Python | os.set_inheritable() method
- Python PIL | blend() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Akanksha_Rai