Jump to content

[SOLVED] Simple Feedparser Script Not Working


Recommended Posts

Hello. I wrote this code for python 3 before discovering that it is not supported by Alfred. Ever since, I have failed to convert it to python 2 and to be able to incorporate it in a workflow. This is the original script that was working just fine:
 

#!/Users/Me/anaconda3/bin/python

import feedparser

d = feedparser.parse('https://www.aliftaa.jo/PrayTimes.ashx')
print(d['entries'][0]['title'])
print(d['entries'][1]['title'])
print(d['entries'][2]['title'])
print(d['entries'][3]['title'])
print(d['entries'][4]['title'])
print(d['entries'][5]['title'])

 

I changed the shebang to (#!/usr/bin/python) and removed the parentheses in the print functions. However when I run it in terminal (using python2) it says that "list index out of range" and in python launcher 2.7 "No module named feedparser". I'm not experienced with programming so I have been struggling to figure it out on my own but I have failed to do so for the couple past days. Any help is deeply appreciated!

Edit: I installed feedparser in the python 2.7 directory and it imports normally in terminal.

Edited by Yaz
Added essential info
Link to comment
11 hours ago, deanishe said:

 

Alfred works fine with Python 3. You can use your existing, Python 3 script by setting Language to External Script.


Thank you so much! It finally worked after my many failing attempts to convert it to python 2.

P.s. Alfred is absolutely my favorite app on my Mac. It really is an essential app for productivity and it complements MacOS perfectly. I really appreciate your work!

Link to comment
  • vitor changed the title to [SOLVED] Simple Feedparser Script Not Working

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