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

On 6 Mar 2020, at 11:12, Paul Gobble wrote:

Sam,

Thank you for your input. Yes, my Mac is running MacOS 10.15.3 Catalina. I
tried the tests you suggested, see below.

#!/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 %

So, no, nothing about quarantine was reported. And yes, if I pass it to
/usr/bin/python3 on the command line (the exact same path as in the
Shebang) it runs fine.

On Friday, March 6, 2020 at 9:58:23 AM UTC-5, Sam Hathaway wrote:

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

On 4 Mar 2020, at 23:25, Paul Gobble wrote:

I'm using BBedit 13.0.5 on Mac Os 10.15.3 as my editor while I try to
learn a bit of Python3.

#!/usr/bin/env python3
print('Hello World')

Baby steps.

I try to execute this from the Run menu item in the #! menu and get

/Users/.../Scripts/python_test-01.py: line 1: #!/usr/bin/env: No such
file or directory

Then I try to use the direct path in the shebang line

#!/usr/bin/python3
print('Hello World')

and get a very similar response

/Users.../Scripts/python_test-01.py: line 1: #!/usr/bin/python3: No such
file or directory

So I go investigate in the Terminal app and look around.

Emonda: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$

Both env and python3 are right where I said they were in the shebang line,
but interpreter can't find them!

Can anyone help me out here?  What am I missing?

Thanks,
Paul

--
This is the BBEdit Talk public discussion group. If you have a feature
request or need technical support, please email "[email protected]
<javascript:>" 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 [email protected] <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/e1aaa223-81f1-4c3d-96e6-dd0872e7d420%40googlegroups.com
<https://groups.google.com/d/msgid/bbedit/e1aaa223-81f1-4c3d-96e6-dd0872e7d420%40googlegroups.com?utm_medium=email&utm_source=footer>
.



--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/bea4b23d-760a-4e96-a121-93051736af6b%40googlegroups.com.


--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "[email protected]" 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2C75D612-94E2-4744-BF94-EB12B98C7095%40munkynet.org.

Reply via email to