Jump to content

[SOLVED] Run Python script action


Recommended Posts

Hello,

 

I have a Python script which uploads some files. It outputs a few messages to the console when running. I've added the PATH to its location in .bash_profile and so I can run it from anywhere just by typing the name (I have also removed the .py extension to make that easier).

 

I'd like to be able to run it using an Alfred keyword. I've created a blank workflow, added a keyword input and connected a Run Script action to it. I've selected "Exernal Script" and entered the name. This didn't work, so I modified the "Script File" field to include the full path to the file. This made the actual text contents of the script appear in the window of the Script Action, but the action still doesn't do anything.

 

What am I doing wrong?

 

Thanks.

 

(macOS 10.14.6 BTW)

Link to post
1 hour ago, Stratocumulus said:

What am I doing wrong?

 

We can't really tell you why a workflow we've never seen isn't working, especially not with a problem description of "doesn't do anything".

 

Use Alfred's debugger. There's quite likely a useful error message in there. Also bear in mind that Alfred doesn't load your shell configuration files and doesn't share your shell environment. If you script depends on anything configured in your dotfiles, it won't work in Alfred.

 

If you'd like our help, please upload your workflow and script somewhere and post links, so we can have a look for ourselves.

Link to post
  • vitor changed the title to [SOLVED] Run Python script action
  • 4 weeks later...
22 hours ago, jbreeden said:

Any idea why `env` doesn't get the job done here?

 

env only runs programs  on PATH, and the entire problem here was that the program isn't on PATH.

 

Alfred doesn't use the same environment as your shell because it isn't run from your shell, so if your program isn't in /bin or /usr/bin, it must be called by its full path, not just its name, from within Alfred (and other Mac apps).

Link to post

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...