My script.py creates a temporary file in the same dir as the script.
When running it:
python script.py
it works just file
but it doesn't work when you run:
python /path/to/script.py
That's because I'm using a relative path to my temp file in script.py rather than an absolute one. The problem is that I don't know in which path it will be running in, so I need a way to dinamicaly know this.
What about?
os.path.abspath(os.path.dirname(__file__))