Test fixture failure zope.interface under Python 3.1
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all (and especially Lennart), I need a quick sanity check. Trying to test a package of mine for Python 3 compatibility I built Python 3.1.2 and installed distribute into it. My package depends on zope.interface. I am executing... $ python3.1 setup.py test It tries to install zope.interface, but fails with this traceback: Running zope.interface-3.6.0/setup.py -q bdist_egg --dist-dir /var/folders/ZD/ZDGPtbYeGkqB4K7rOkPK4U+++TI/-Tmp-/easy_install-8LJGXC/zope.interface-3.6.0/egg-dist-tmp-xVkH07 Traceback (most recent call last): File "setup.py", line 58, in <module> <snip> File "/usr/local/lib/python3.1/site-packages/distribute-0.6.10-py3.1.egg/setuptools/sandbox.py", line 33, in <lambda> {'__file__':setup_script, '__name__':'__main__'}) File "setup.py", line 80, in <module> That's not very informative at all. Trying to debug this further I download zope.interface 3.6.0 and attempt to run its tests using "setup.py test", which gives a little more information: Traceback (most recent call last): File "setup.py", line 80, in <module> + '\n' + File "setup.py", line 65, in read return open(os.path.join(os.path.dirname(__file__), *rnames)).read() File "/usr/local/lib/python3.1/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128) The issue is a non-ASCII character in the Changelog: <snip> - - Added support for Python 3.1. Contributors: Lennart Regebro Martin v Löwis Thomas Lotze Wolfgang Schnerring </snip> Removing the "ö" I can run the tests and buildout. Question: Is this an issue with my particular sandbox? The Python 3.1 I use is a fresh build and I don't manipulate the default encoding anywhere. Thanks! jens -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkvdqjgACgkQRAx5nvEhZLJhpACgunVHthigpkiLO9K4JIskMEYC MGUAn3ocaSIgdrMJG10szA+Ji/48OLO2 =Vfi3 -----END PGP SIGNATURE-----
On Sun, May 2, 2010 at 18:37, Jens Vagelpohl <jens@dataflake.org> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi all (and especially Lennart),
I need a quick sanity check. Trying to test a package of mine for Python 3 compatibility I built Python 3.1.2 and installed distribute into it. My package depends on zope.interface. I am executing...
$ python3.1 setup.py test
It tries to install zope.interface, but fails with this traceback:
Running zope.interface-3.6.0/setup.py -q bdist_egg --dist-dir /var/folders/ZD/ZDGPtbYeGkqB4K7rOkPK4U+++TI/-Tmp-/easy_install-8LJGXC/zope.interface-3.6.0/egg-dist-tmp-xVkH07 Traceback (most recent call last): File "setup.py", line 58, in <module> <snip> File "/usr/local/lib/python3.1/site-packages/distribute-0.6.10-py3.1.egg/setuptools/sandbox.py", line 33, in <lambda> {'__file__':setup_script, '__name__':'__main__'}) File "setup.py", line 80, in <module>
That's not very informative at all. Trying to debug this further I download zope.interface 3.6.0 and attempt to run its tests using "setup.py test", which gives a little more information:
Traceback (most recent call last): File "setup.py", line 80, in <module> + '\n' + File "setup.py", line 65, in read return open(os.path.join(os.path.dirname(__file__), *rnames)).read() File "/usr/local/lib/python3.1/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 290: ordinal not in range(128)
The issue is a non-ASCII character in the Changelog:
<snip> - - Added support for Python 3.1. Contributors:
Lennart Regebro Martin v Löwis Thomas Lotze Wolfgang Schnerring </snip>
Removing the "ö" I can run the tests and buildout. Question: Is this an issue with my particular sandbox? The Python 3.1 I use is a fresh build and I don't manipulate the default encoding anywhere.
Hmm, I do not get that issue, but maybe the default encoding is different on different systems? What are you using? I'll change that to Loewis in any case, having non-ascii test like that is definitely a no-no. You would think that after 30 years of these kinds of problems I would have learnt, but apparently not. :) -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 5/2/10 21:30 , Lennart Regebro wrote:
On Sun, May 2, 2010 at 18:37, Jens Vagelpohl <jens@dataflake.org> wrote:
The issue is a non-ASCII character in the Changelog:
<snip> - - Added support for Python 3.1. Contributors:
Lennart Regebro Martin v Löwis Thomas Lotze Wolfgang Schnerring </snip>
Removing the "ö" I can run the tests and buildout. Question: Is this an issue with my particular sandbox? The Python 3.1 I use is a fresh build and I don't manipulate the default encoding anywhere.
Hmm, I do not get that issue, but maybe the default encoding is different on different systems? What are you using?
This is on OS X 10.6.3 and sys.getdefaultencoding says UTF-8. It seems that the call opening the file ends up with a file handle that assumes the file contains ASCII: (Pdb) p open(os.path.join(os.path.dirname(__file__), *rnames)) <_io.TextIOWrapper name='CHANGES.txt' encoding='US-ASCII'> A little digging[1] tells me the determining factor for this assumed encoding is the return value of locale.getpreferredencoding, which for me is ASCII:
locale.getpreferredencoding() 'US-ASCII'
What does your system say? jens [1] http://docs.python.org/py3k/library/functions.html#open -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkvd4foACgkQRAx5nvEhZLKmgACfR97RYPAk5bL8AHDUOrkZoZZO AFUAoIeXrs2DvQ4cusPOOYjFeTckujbS =m2pV -----END PGP SIGNATURE-----
On Sun, May 2, 2010 at 22:35, Jens Vagelpohl <jens@dataflake.org> wrote:
locale.getpreferredencoding()
'UTF-8' on Ubuntu. And I think Windows has something else as well, but then again Hanno was able to release Windows binaries. Strange that it didn't fail there. Tres got rid of some warnings when compiling as well, so it'll be a more polished release all around. :) -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
participants (2)
-
Jens Vagelpohl -
Lennart Regebro