spawar Posted July 22, 2021 Posted July 22, 2021 (edited) Hi All, Newbie here. I just installed Alfred and wondering how to run my python script. I set it up as in the screenshots. When i type satt in my alfred app nothings happens. Below is the content of my script. cat hello.py #!/usr/bin/python3 print('hello world') Can you please suggest if any other configuration i need to . I googled a lot and also seached on youtube, i didnt get answer to question. Note: It works fine if I use "Terminal Command" instead of "Run Script". The thing is I dont know how to pass variables etc when using "Terminal Command" , so i have to rely on "Run Script" Edited July 22, 2021 by spawar
deanishe Posted July 23, 2021 Posted July 23, 2021 7 hours ago, spawar said: Can you please suggest if any other configuration i need to An obvious cause would be that you forgot to make the script executable. Run chmod +x ~/hello.py in a shell and see if that fixes the problem.
spawar Posted July 23, 2021 Author Posted July 23, 2021 (edited) @deanishe, Thank you for responding. It is already executable Quote ls -lrt hello.py -rwxr-xr-x 1 spawar staff 40 Jul 22 19:20 hello.py Edited July 23, 2021 by spawar
giovanni Posted July 23, 2021 Posted July 23, 2021 where do you want 'hello world' to be printed? spawar 1
deanishe Posted July 23, 2021 Posted July 23, 2021 (edited) On 7/23/2021 at 9:32 PM, spawar said: @deanishe, Thank you for responding. It is already executable Right, then the script is presumably running just fine. As @giovanni is hinting, print() won’t show any text anywhere because you haven’t connected it to anything that shows text… Either plug it into a Large Type or a Show Notification, or change it to print('blah', file=sys.stderr), in which case the text will be shown in Alfred’s debugger. Also, you probably want print('some text', end='') if you're not printing to the debugger, so there isn’t a newline on the end of the text. Edited July 25, 2021 by deanishe spawar 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now