Top "Os.path" questions

Python module implementing common pathname manipulations

How/where to use os.path.sep?

os.path.sep is the character used by the operating system to separate pathname components. But when os.path.sep …

python os.path
os.path.isdir returns false when folder exists?

I have the following code which checks if the directory exists def download(id, name, bar): cwd = os.getcwd() dir = …

python os.path
How to workaround `exist_ok` missing on Python 2.7?

On Python 2.7 os.makedirs() is missing exist_ok. This is available in Python 3 only. I know that this is the …

python-2.7 os.path
Python raise NotADirectoryError

I'm trying to raise an error when a directory does not exist, before I open files in that directory. According …

python exception os.path
Use os.listdir to show directories only

How can I bring python to only output directories via os.listdir, while specifying which directory to list via raw_…

python raw-input os.path
How to extract a file within a folder within a zip?

I need to extract a file called Preview.pdf from a folder called QuickLooks inside of a zip file. Right …

python file-extension zipfile sys os.path
os.path.join fails with "TypeError: object of type 'LocalPath' has no len()"

This error appeared when trying to use the 'tmpdir' in a pytest test. TypeError: object of type 'LocalPath' has no …

python pytest os.path