My script.py creates a temporary file using a relative path.
When running it as:
python script.py
it works as expected.
But it doesn't work when you run it like:
python /path/to/script.py
The problem is that I don't know which path it will be running in. How can I get the absolute path to the script folder (the "/path/to") so the temporary file can be created in the same directory as the script?
What about the following?
os.path.abspath(os.path.dirname(__file__))