I need to load some data from the folder in which my Desktop\diodo_laser\grafici_diodo_laser.py file that I'm using is saved. I run my Python files with Pyzo IDE and I'm not running it as a script, rather I'm running it from the editor. Other topics on this (like Find path to currently running file or How to get the path and name of the Python file that is currently executing?) suggest using one amongst os.getcwd(), sys.argv[0], sys.path[0] or __file__, but neither of these get me where I want, because I'm neither running it as a script nor running it from the cmd terminal, so all of those commands result in C:\Users\myname or a blank string (and __file__ gives NameError: name '__file__' is not defined. Did you mean: '__name__'?). What I want to get is "C:\Users\myname\Desktop\diodo_laser\grafici_diodo_laser.py", or the same without "grafici_laser_diodo.py", which is the directory in which the .py file is saved, to be put in the program without having to open it with the terminal (I want to run the program using the "execute cell" button, so I'm not able to use __file__). Continue reading...