Jump to content

How to run my first script in Alfred


Recommended Posts

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.

 

 

Screen Shot 2021-07-22 at 7.23.45 PM.png

Screen Shot 2021-07-22 at 7.23.31 PM.png

 

 

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"

Screen Shot 2021-07-22 at 7.41.00 PM.png

Edited by spawar
Link to comment
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 by deanishe
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...