[Snowball-discuss] PyStemmer: " 'dict' object has no attribute 'iteritems'" on Python 3

Marc Abramowitz marca at surveymonkey.com
Fri Feb 22 05:27:08 GMT 2013


After messing around with this a bit, I think that my patch is probably not necessary.

I discovered that the code works as-is if I build it myself. It only fails if I pip install PyStemmer.

Based on this, I suspect that the problem is the version of Cython used to build the sdist. Cython 0.11 was used to generate the sdist on PyPI and I have a feeling that this version doesn't know how to generate the appropriate C code needed to translate "iteritems" for Python 3. When I build PyStemmer from source, I'm using Cython 0.17 and this version of Cython probably does the correct translation for Python 3. This is my theory at least. I was hoping to test the theory by installing Cython 0.11 on my Mac, but I've run into problems with building it.

I think all that might be necessary is to generate a new sdist for PyPI using a newer version of Cython.

From: Marc Abramowitz <marca at surveymonkey.com<mailto:marca at surveymonkey.com>>
Date: Thursday, February 21, 2013 12:51 PM
To: "snowball-discuss at lists.tartarus.org<mailto:snowball-discuss at lists.tartarus.org>" <snowball-discuss at lists.tartarus.org<mailto:snowball-discuss at lists.tartarus.org>>
Subject: Re: [Snowball-discuss] PyStemmer: " 'dict' object has no attribute 'iteritems'" on Python 3

An update to my previous message.

I figured out how to do the build. I had to manually download http://snowball.tartarus.org/dist/libstemmer_c.tgz and untar it in the pystemmer directory. That made `python setup.py build`, etc. work.

So then I came up with a patch to fix the "iteritems" issue in __purgeCache on Python 3. Here it is:

https://gist.github.com/msabramo/5008065

I hope that is useful. Thanks for creating and sharing PyStemmer!

Cheers,
Marc
http://marc-abramowitz.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tartarus.org/mailman/private/snowball-discuss/attachments/20130222/db57a90e/attachment.htm>


More information about the Snowball-discuss mailing list