Hi everyone,
I am having issues running Python 3 scripts with KM version 9.0.5 (whose existence, by the way, makes me extremely grateful). I am using macOs Sierra.
I. When I run this very simple script from Terminal (by simply writing python3 ScriptTest.py), it works :
f = open("demofile2.txt", "a")
f.write("See you soon!")
f.close()
f = open("demofile2.txt", "r")
print(f.read())
The file that contains it is located in Documents.
Now, despite having set the ENV_PATH variable to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin as recommended, when I use the action Execute “ScriptTest.py” Shell Script I get the following error message : /bin/sh: /Users/[my name]/Documents/ScriptTest.py: Permission denied. How come ?
Edit : I have succeeded at last, by simply writing : python3 /Users/[My name]/documents/ScriptTest.py... That was easy enough. I still get the same error, though : PermissionError: [Errno 13] Permission denied: 'demofile2.txt'.
II. When I use the "Execute test script" in KM, adding the line #!/usr/bin/env python3 prior to the aforementioned code, here is what happens :
Traceback (most recent call last):
File "/var/folders/0n/1x_zhb7949b1y00gf_bnw4_00000gn/T/Keyboard-Maestro-Script-BE5BC790-E35C-445C-95A0-A2E96F25580D", line 3, in
f = open("demofile2.txt", "a")
PermissionError: [Errno 13] Permission denied: 'demofile2.txt'
I must have spent a couple of hours trying to figure out how to overcome these two problems, which must doubtless be trivial. As you can tell, I am but a beginner, sorry for the hassle and thanks in advance for your help !