holyjaw Posted December 29, 2013 Share Posted December 29, 2013 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
jdfwarrior Posted December 30, 2013 Share Posted December 30, 2013 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
holyjaw Posted December 30, 2013 Author Share Posted December 30, 2013 Here ya go: https://www.dropbox.com/s/uwvrpxvdbjduxqb/Screenshot%202013-12-29%2021.12.53.png (it's a .png so I can't inline). Link to comment
jdfwarrior Posted December 31, 2013 Share Posted December 31, 2013 Here ya go: https://www.dropbox.com/s/uwvrpxvdbjduxqb/Screenshot%202013-12-29%2021.12.53.png (it's a .png so I can't inline). Tried adding: <?xml version="1.0"?> to the top to see if that works? I believe it's not considered valid otherwise Link to comment
holyjaw Posted December 31, 2013 Author Share Posted December 31, 2013 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
jdfwarrior Posted December 31, 2013 Share Posted December 31, 2013 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
holyjaw Posted January 2, 2014 Author Share Posted January 2, 2014 (edited) That looks right. Silly question but didn't see it above... this is in a Script Filter right? Not a Run Script? Correct, it's being run as a Script Filter Edited January 2, 2014 by holyjaw Link to comment
jdfwarrior Posted January 2, 2014 Share Posted January 2, 2014 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
holyjaw Posted January 3, 2014 Author Share Posted January 3, 2014 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 Link to comment
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