Does anyone have a sample of using the new “inline script” on Mac OS capability to write to STDOUT? I got it to run a Python script in a file. But a one-line print “Hello” does nothing - for me.
Where would you like stdout to go? I can access it, I’m just tossing it right now.
I’m not sure what the options are - but some form of feedback from a script is good.
My 1-line (plus shebang line) Python “Hello World” appeared to do nothing. It might’ve run but then again it might not have. (And, by the way, what happens if I have a syntax error?)
I would think stdout and stderr go to a terminal window, and stdin comes from the same window. (Trying to create your own console or GUI would be hard and probably not worth it.)
Some simple options for providing feedback:
- use the ‘say’ command to say something
- use osascript to trigger something (a dialog box, a notification) using AppleScript or another OSA language
- use the ‘syslog’ command to output something to Console (with a prefix you can search for, as there’s way too much info these days) — for example “syslog -s -l 3 ‘BLAH: foo!’”
Thanks @njr. I like those ideas.
The issue here is that if I put print “Hello” in an “inline” script there’s nowhere for the “hello” to be displayed.
I think there probably should be.
It seems if you put the python in a file it DOES create a terminal window. (I just proved that by trying it.)
I would contemplate Run Script being used mostly for prototyping so it would be nice if it could do say or whatever to a terminal window.