You can run Python on Atom using atom-runner, one of Atom's packages. However, since the current directory at runtime becomes the project folder, the current directory changes depending on the open folder. This behavior is a bit annoying when you simply want to use a relative path.
Align the current directory with the directory where the file exists.
import sys
import os
os.chdir(os.path.dirname(sys.argv[0]))
I wonder if this is enough for a write-down script that cannot be read from other files.
Recommended Posts