alfred-workflow icon indicating copy to clipboard operation
alfred-workflow copied to clipboard

Can't get Script Filter to find the pinboard.py file from the tutorial

Open felciano opened this issue 4 years ago • 1 comments

I've been unable to replicate the pinboard example from the tutorial. The code runs fine when run from the command line, but when triggered via Alfred no list items show up. Per the debugger it looks like Alfred can't find the script:

[21:38:51.942] Logging Started...
[21:40:04.764] File namer[Snippet] Processing complete
[21:40:04.770] File namer[Snippet] Passing output '' to Script Filter
[21:40:04.788] File namer[Script Filter] Queuing argument '(null)'
[21:40:04.877] File namer[Script Filter] Script with argv '(null)' finished
[21:40:04.880] ERROR: File namer[Script Filter] Code 2: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'pinboard.py': [Errno 2] No such file or directory

This is when the Script Filter is configured with /bin/bash and

python pinboard.py

The script is located in the workflow directory, and if I pass in a complete pathname, it works.

Is there something special needed for the Script Filter to launch in the workflow directory and thus be able to use filenames relative to that directory?

felciano avatar Nov 05 '21 04:11 felciano

Hey @felciano I had this problem too, and when I went to https://pypi.org/project/Alfred-Workflow/ to dig deeper I saw the directory structure as it is meant to work:

Your Workflow/
    info.plist
    icon.png
    workflow/
        __init__.py
        background.py
        notify.py
        Notify.tgz
        update.py
        version
        web.py
        workflow.py
    yourscript.py
    etc.

I think the confusion in the instructions is "Your Workflow" top level folder vs the "workflow" folder from this project.

When the file is in the top level, it works.

The 'workflow' folder isn't something we are meant to change. It's a library we're able to reference in our Python ie:

from workflow import Workflow, web

So anything we write should stay in the root folder like the icon and the plist.

Fingers crossed that's right. Don't want to send everyone astray.

lisaross avatar Nov 27 '21 00:11 lisaross