[IronPython] [python] IronPython Community Edition - FeedParser Weirdness

Michael Foord fuzzyman at voidspace.org.uk
Thu Dec 27 22:29:47 CET 2007


Hmm... no '__delattr__' or '__getattribute__' to start with - and more 
importantly no entries. Odd. I wonder if an exception is being raised in 
fetching the feed (or something...) and being suppressed by feedparser.

I'm afraid that unless anyone has any direct experience of using 
feedparser with IronPython, the only option is to follow the code 
backwards until you find the problem...

Michael
http://www.manning.com/foord

Tim Riley wrote:
> Yeah something isn't right.
>
> Python 2.5 output gives me:
> ['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__',
> '__dict__', '__doc__', '__eq__', '__ge__', '__getattr__',
> '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__',
> '__iter__', '__le__', '__len__', '__lt__', '__module__', '__ne__',
> '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
> '__setitem__', '__slotnames__', '__str__', '__weakref__', 'clear',
> 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems',
> 'iterkeys', 'itervalues', 'keymap', 'keys', 'pop', 'popitem',
> 'setdefault', 'update', 'values']
> 14
>
> ipy.exe output gives me:
> ['__class__', '__cmp__', '__contains__', '__delitem__', '__dict__',
> '__doc__', '__eq__', '__getattr__', '__getitem__', '__hash__',
> '__init__', '__iter__', '__len__', '__module__', '__ne__', '__new__',
> '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
> '__setitem__', '__str__', '__weakref__', 'clear', 'copy', 'fromkeys',
> 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues',
> 'keymap', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
> 0
>
>
> Tim
>
>
>
> On Dec 27, 2007 3:28 PM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
>   
>> Tim Riley wrote:
>>     
>>> I am trying to access my gmail account using the latest IronPython
>>> Community Edition (IPY, not IPY2) and the python feedparser library.
>>> When I run the following script through python 2.5 everything works
>>> great, however when I run it through ipy.exe I get an error. I was
>>> wondering if anyone has any experience using feedparser with ipy and
>>> if so if they could give me a pointer on how to get this working.
>>>
>>>
>>>
>>>       
>> What happens if you replace the line:
>>
>>         print usermail.feed.title
>>
>> With
>>
>>         print dir(usermail.feed)
>>
>> ?
>>
>> The feedparser code isn't failing, but it looks like you aren't getting back what you expect...
>>
>> Michael
>> http://www.manning.com/foord
>>
>>
>>
>>
>>     
>>> Here is the code:
>>>
>>> #################code#####################
>>> #Note: Build with IronPython Community Edition, Not Standard IronPython
>>>
>>> #import statements
>>> import ConfigParser
>>> import feedparser
>>>
>>>
>>> def generateURL():
>>>     """
>>>     Generates a the url for the ATOM feed by reading the username and
>>> password from the config file.
>>>     """
>>>     config = ConfigParser.ConfigParser()
>>>     config.read("config.ini")
>>>     return "https://%s:%s@gmail.google.com/gmail/feed/atom" %
>>> (config.get("app:main", "username"), config.get("app:main",
>>> "password"))
>>>
>>>
>>> def checkmail():
>>>     usermail = feedparser.parse(generateURL())
>>>     #for testing only
>>>     print usermail.feed.title
>>>     print len(usermail['entries'])
>>>
>>> if __name__ == "__main__":
>>>     checkmail()
>>> #################code#####################
>>>
>>>
>>> and here is the output:
>>>
>>> ################output####################
>>>
>>>
>>>
>>> C:\Documents and Settings\TJRiley\Desktop\testing\ipygmail>python ipygmail.py
>>> Gmail - Inbox for riltim at gmail.com
>>> 9
>>>
>>> C:\Documents and Settings\TJRiley\Desktop\testing\ipygmail>ipy ipygmail.py
>>> Traceback (most recent call last):
>>>   File C:\Documents and Settings\TJRiley\Desktop\testing\ipygmail\ipygmail.py, l
>>> ine 25, in Initialize
>>>   File C:\Documents and Settings\TJRiley\Desktop\testing\ipygmail\ipygmail.py, l
>>> ine 20, in checkmail
>>> AttributeError: title
>>>
>>> ################output####################
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>>       
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>     
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>   




More information about the Ironpython-users mailing list