does Python have a portable way to get the path of the current (working) directory?
Yes, I use it all the time
from pathlib import Path
current_directory = Path(__file__).parent
import os
cwd = os.getcwd()
os stuff even works on Windows?
From
documentation
Output:
os — Miscellaneous operating system interfaces
Source code: Lib/os.py
This module provides a portable way of using operating system dependent functionality. If you just want to read or write a file see open(), if you want to manipulate paths, see the os.path module, and if you want to read all the lines in all the files on the command line see the fileinput module. For creating temporary files and directories see the tempfile module, and for high-level file and directory handling see the shutil module.
what if i want to os.dup2() a file descriptor? i didn't know Windows had file descriptors.