Every line of 'get directory of file python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
57 def get_data_files_path(): 58 """Get a direct path to the data files colocated with the script. 59 60 Returns: 61 The directory where files specified in data attribute of py_test 62 and py_binary are stored. 63 """ 64 return _os.path.dirname(_inspect.getfile(_sys._getframe(1)))
102 def DirectoryOfThisScript(): 103 return os.path.dirname(os.path.abspath(__file__))
67 def _get_dir(f): 68 return os.path.dirname(f)
5 def get_script_dir(follow_symlinks=True): 6 if getattr(sys, 'frozen', False): # py2exe, PyInstaller, cx_Freeze 7 path = os.path.abspath(sys.executable) 8 else: 9 path = inspect.getabsfile(get_script_dir) 10 if follow_symlinks: 11 path = os.path.realpath(path) 12 return os.path.dirname(path)
19 def get_file(filename): 20 """Return the path of a test file.""" 21 return os.path.join(TEST_DIR, filename)