Jump to content

Workflow disappears when selected


Recommended Posts

Hi there,

 

I have a workflow triggered by a keyword. The workflow is simply:

import getSchedule as gs

print(gs.get_schedule())

When I type the keyword in to Alfred, the workflow shows up, but as soon as it is the top result, or I select it otherwise and the workflow is activated, it immediately is removed from the list of results. 

 

I have thoroughly debugged the script; when run in a terminal the script outputs the proper XML from `alp`.

 

I'm not certain where to go from here, any ideas?

Link to comment

Hi there,

 

I have a workflow triggered by a keyword. The workflow is simply:

import getSchedule as gs

print(gs.get_schedule())

When I type the keyword in to Alfred, the workflow shows up, but as soon as it is the top result, or I select it otherwise and the workflow is activated, it immediately is removed from the list of results. 

 

I have thoroughly debugged the script; when run in a terminal the script outputs the proper XML from `alp`.

 

I'm not certain where to go from here, any ideas?

 

Can you provide a screenshot of the output (just a screenshot of the terminal window so I can see it all)?

 

This is normally the result of an invalid character in the xml output or, there is something else that is also being output with the xml that isn't being noticed (some form of error or something)

Link to comment

Hm, the issue persists (https://www.dropbox.com/s/e9na1awfm4pxvjv/Screenshot%202013-12-30%2021.47.51.png), but I think I see where part of the problem may lie.

 

alp.feedback prints the XML instead of returning the XML, so my code:

def get_schedule:
    ...
    feedback = alp.feedback(feedback_items)
    return feedback

if __name__=="__main__":
    print get_schedule

Was actually printing the XML generated by alp.feedback to console by the alp.feedback method. feedback = alp.feedback(feedback_items) was in turn a null object, and so print get_schedule was returning 'None'. This had been vexing me for most of the day and I thought I had found a workaround; apparently not.

 

I had to modify alp.feedback to 'return' instead of 'print', and now I'm able to get what you see in the screenshot.

Link to comment

Hm, the issue persists (https://www.dropbox.com/s/e9na1awfm4pxvjv/Screenshot%202013-12-30%2021.47.51.png), but I think I see where part of the problem may lie.

 

alp.feedback prints the XML instead of returning the XML, so my code:

def get_schedule:
    ...
    feedback = alp.feedback(feedback_items)
    return feedback

if __name__=="__main__":
    print get_schedule

Was actually printing the XML generated by alp.feedback to console by the alp.feedback method. feedback = alp.feedback(feedback_items) was in turn a null object, and so print get_schedule was returning 'None'. This had been vexing me for most of the day and I thought I had found a workaround; apparently not.

 

I had to modify alp.feedback to 'return' instead of 'print', and now I'm able to get what you see in the screenshot.

 

That looks right. Silly question but didn't see it above... this is in a Script Filter right? Not a Run Script?

Link to comment

Correct, it's being run as a Script Filter

 

Try taking your xml and saving it to the clipboard, make a quick workflow with a script filter and use bash and "cat" to print the xml to the script filter and see if the results show up that way. There's an example of this in Alfred. If you click the + to create a new workflow, its under Examples->Script Filter XML format.

 

If the raw XML works, then we'll know there's something in the script that is, not necessarily broken, but doing something that we aren't noticing or aren't expecting. If the raw XML doesn't work, then there's probably something wrong with the formatting of it.

Link to comment

Thanks for that tip. I honestly don't know what exactly fixed the issue (yay for the shotgun approach), but I changed "return" to "print" in my Script Filter, changed it from "No Argument" to "With Space / Argument Optional" back to "No Argument" and realized that Info.plist was missing. So, between taking care of all of these, something clicked. So, thanks  :D

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