Hi Dave,
I think os.getcwd will do. Thanks!
Search found 3 matches
- Thu Jan 19, 2017 12:36 pm
- Forum: General Discussion and Questions
- Topic: Getting path of current script
- Replies: 4
- Views: 3782
- Wed Jan 11, 2017 9:36 am
- Forum: General Discussion and Questions
- Topic: Getting path of current script
- Replies: 4
- Views: 3782
Re: Getting path of current script
Thanks for the answer Dave. What I need to do is to find out if the current script is running from the internal flash or from the SD card. So the relative path thing is a problem. And __file__ is not defined for main.py. I would like to be able to obtain the absolute path for the current running scr...
- Tue Jan 10, 2017 4:48 pm
- Forum: General Discussion and Questions
- Topic: Getting path of current script
- Replies: 4
- Views: 3782
Getting path of current script
Is there a way of getting the path of the currently executing script?
On the pyboard this simple main.py just prints an empty list for me ([]):
import sys
print(sys.argv)
On the pyboard this simple main.py just prints an empty list for me ([]):
import sys
print(sys.argv)