10 examples of 'get path of file python' in Python

Every line of 'get path 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
19def get_file(filename):
20 """Return the path of a test file."""
21 return os.path.join(TEST_DIR, filename)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

50def get_file_path(): # pragma: no cover
51 commiter = Path('commiter.yml')
52 commit_h = Path('commit-helper.yml')
53
54 if commiter.exists():
55 return commiter
56 else:
57 return commit_h
129def GET_PATH(path):
130 return abspath(join(DOC_ROOT, path))
23def get_data_file(file):
24 return os.path.join(get_data_dir(), file)
36def get_path(filename):
37 return os.path.join(os.path.dirname(__file__), 'test_data', filename)
66def get_file_path(filename):
67 """
68 Find the book_title excel file path.
69 """
70 root_dir = d(d(abspath(__file__)))
71 root = Path(root_dir)
72 filepath = root / 'stateful_book' / filename
73 return r'{}'.format(filepath)
57def 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)))
12def path(filename: str):
13 scriptdir = os.path.dirname(os.path.realpath(__file__))
14 return os.path.join(scriptdir, filename)
8def get_path():
9 """Try to get path to formiko.svg"""
10 bin_path = split(argv[0])[0]
11 icons_path = "icons/formiko.svg"
12 share_path = join("share/formiko", icons_path)
13 while (bin_path != '/'):
14 # this work to /opt /usr /usr/local prefixes
15 if exists(join(bin_path, share_path)):
16 return join(bin_path, share_path)
17 if exists(join(bin_path, icons_path)):
18 return join(bin_path, icons_path)
19 bin_path = split(bin_path)[0]
55def path_file(file):
56 return str(file)

Related snippets