#!/usr/bin/env python3
print('Hello World')/Users/.../Scripts/python_test-01.py: line 1: #!/usr/bin/env: No such file or directory#!/usr/bin/python3
print('Hello World')/Users.../Scripts/python_test-01.py: line 1: #!/usr/bin/python3: No such file or directoryEmonda:bin paul$ pwd
/usr/local/bin
Emonda:bin paul$ whereis python3
/usr/bin/python3
Emonda:bin paul$ whereis env
/usr/bin/env
Emonda:bin paul$
Emonda:bin paul$ python3 --version
Python 3.7.3
paul@Emonda ~ % PATH=/usr/bin:/usr/local/bin:/bin:/usr/sbin:/sbin
paul@Emonda ~ % env
...PATH=/usr/bin:/usr/local/bin:/bin:/usr/sbin:/sbin
...
Then I asked the terminal what it knows about the location of Python3
paul@Emonda ~ % python3 --version
Python 3.7.3
paul@Emonda ~ % which python3
/usr/bin/python3
paul@Emonda ~ % whereis python3
/usr/bin/python3
> To unsubscribe from this group and stop receiving emails from it, send an email to bbe...@googlegroups.com.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbe...@googlegroups.com.
Paul,
I take it you’re on macOS 10.15 Catalina, since /usr/bin/python3 exists.
What do you get if you run this?
ls -le@ /Users/.../Scripts/python_test-01.py
My suspicion is that macOS might have quarantined your script. (I ran into this once or twice after migrating my data to a fresh 10.15 install but I don’t recall the exact error message.)
If you see com.apple.quarantine in that output, you can run this to remove the quarantine flag:
xattr -d com.apple.quarantine /Users/.../Scripts/python_test-01.py
If that isn’t it, I’d be curious to see if you can run the script by passing it to the interpreter like this:
/usr/bin/python3 /Users/.../Scripts/python_test-01.py
Hope this helps.
-sam
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/e1aaa223-81f1-4c3d-96e6-dd0872e7d420%40googlegroups.com.
#!/usr/bin/python3
paul@Emonda Python-RFP-PDF-Scraper % ./python_test-01.py
./python_test-01.py: line 1: #!/usr/bin/python3: No such file or directory
./python_test-01.py: line 2: syntax error near unexpected token `'Hello World''
./python_test-01.py: line 2: `print('Hello World')'
paul@Emonda Python-RFP-PDF-Scraper % ls -le@ ./python_test-01.py
-rwxr-xr-x@ 1 paul staff 43 Mar 6 11:01 ./python_test-01.py
com.apple.lastuseddate#PS 16
com.apple.macl 72
paul@Emonda Python-RFP-PDF-Scraper % /usr/bin/python3 ./python_test-01.py
Hello World
paul@Emonda Python-RFP-PDF-Scraper %To unsubscribe from this group and stop receiving emails from it, send an email to bbe...@googlegroups.com.
This is very curious. I don’t recognize the formatting in the error message you’re getting when you run it directly. If the shell couldn’t find the interpreter in the shebang line, it should say something like “bad interpreter” and exit immediately. Instead, whatever is executing this file goes on to the second line of the script and chokes on the print() statement. What shell do you use? (You can use echo $SHELL to find out.)
I wonder if there’s some kind of encoding problem or stray bytes at the beginning of the file. Can you send me the output of this command?
hexdump -C /Users/.../Scripts/python_test-01.py
Thanks!
-sam
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/bea4b23d-760a-4e96-a121-93051736af6b%40googlegroups.com.
paul@Emonda Python-RFP-PDF-Scraper % hexdump -C ./python_test-01.py00000000 ef bb bf 23 21 2f 75 73 72 2f 62 69 6e 2f 70 79 |...#!/usr/bin/py|00000010 74 68 6f 6e 33 0a 70 72 69 6e 74 28 27 48 65 6c |thon3.print('Hel|00000020 6c 6f 20 57 6f 72 6c 64 27 29 0a |lo World').|0000002b
00000000 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 70 |#!/usr/bin/env p|00000010 79 74 68 6f 6e 33 0a 70 72 69 6e 74 28 27 48 65 |ython3.print('He|00000020 6c 6c 6f 20 57 6f 72 6c 64 27 29 0a |llo World').|0000002c
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/bea4b23d-760a-4e96-a121-93051736af6b%40googlegroups.com.
Yup, you’ve got a byte-order marker there. Try re-saving the file as “Unicode (UTF-8)” rather than “Unicode (UTF-8, with BOM)”. And if BBEdit is saving UTF-8 files with a BOM by default, you’ll probably want to change the “Default text encoding for new documents” in Preferences > Text Encodings. (There’s no good reason to have a BOM for UTF-8.)
Hope this helps!
-sam
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/2aeaf792-3c3b-4e01-8503-6b4982bfaea1%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/2aeaf792-3c3b-4e01-8503-6b4982bfaea1%40googlegroups.com.
Glad I could help, Paul. I like sour beers and belgians. ;-)
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/67f2ab19-de18-48b9-9c88-13ad9d1a7eae%40googlegroups.com.