Traceback errors in python

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
jachin99
Experienced User
Posts: 492
Joined: Sat Feb 13, 2016 8:39 pm

Traceback errors in python

Post by jachin99 » Tue Oct 03, 2017 5:34 pm

When I try to play this script in pycharm I get an error but when I start python from the command line, and run the script it works fine. Why is that. I'm on python 2.7

import feedparser

d=feedparser.parse('http://www.espn.com/espn/rss/')

for post in d.entries:
print post.title+ ":"+post.link+"\n"

works in the CLI but in pycharm I get this error
C:\Python27\python.exe C:/Users/Jachi/Desktop/feedparser.py
Traceback (most recent call last):
File "C:/Users/Jachi/Desktop/feedparser.py", line 1, in <module>
import feedparser
File "C:\Users\Jachi\Desktop\feedparser.py", line 3, in <module>
d=feedparser.parse('http://www.espn.com/espn/rss/')
AttributeError: 'module' object has no attribute 'parse'

Process finished with exit code 1

User avatar
topix
Experienced User
Posts: 413
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: Traceback errors in python

Post by topix » Sat Oct 07, 2017 6:26 pm

Check you pycharm configuration. Did you really select the right python interpreter?

Post Reply