Message257333
I notice similar problems, as found when running the test suite for lxml 3.5.0 on python2.7
======================================================================
ERROR: test_etree_parse_io_error (lxml.tests.test_io.ETreeIOTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/local/lib/python2.7/unittest/case.py", line 329, in run
testMethod()
File "/tmp/pkgsrc/textproc/py-lxml/work/lxml-3.5.0/src/lxml/tests/test_io.py", line 276, in test_etree_parse_io_error
dn = tempfile.mkdtemp(prefix=dirnameRU)
File "/opt/local/lib/python2.7/tempfile.py", line 339, in mkdtemp
_os.mkdir(file, 0700)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 40-53: ordinal not in range(128)
======================================================================
ERROR: test_etree_parse_io_error (lxml.tests.test_io.ElementTreeIOTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/local/lib/python2.7/unittest/case.py", line 329, in run
testMethod()
File "/tmp/pkgsrc/textproc/py-lxml/work/lxml-3.5.0/src/lxml/tests/test_io.py", line 276, in test_etree_parse_io_error
dn = tempfile.mkdtemp(prefix=dirnameRU)
File "/opt/local/lib/python2.7/tempfile.py", line 339, in mkdtemp
_os.mkdir(file, 0700)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 40-53: ordinal not in range(128)
the code snippet is in test_io.py", line 276
266 def test_etree_parse_io_error(self):
267 # this is a directory name that contains characters beyond latin-1
268 dirnameEN = _str('Directory')
269 dirnameRU = _str('КÐ\260Ñ\032Ð\260Ð\273Ð\276Ð\263')
270 filename = _str('nosuchfile.xml')
271 dn = tempfile.mkdtemp(prefix=dirnameEN)
272 try:
273 self.assertRaises(IOError, self.etree.parse, os.path.join(dn, filename))
274 finally:
275 os.rmdir(dn)
276 dn = tempfile.mkdtemp(prefix=dirnameRU)
277 try:
278 self.assertRaises(IOError, self.etree.parse, os.path.join(dn, filename))
279 finally:
280 os.rmdir(dn)
even if I change dirnameRU to a simple French 'Répertoire' I still get errors...
It is not an option to upgrade to 3.0, sorry.
BTW, I tried passing dirnameRU.encode('utf-8') but that just generates
a different error:
ERROR: test_etree_parse_io_error (lxml.tests.test_io.ETreeIOTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/local/lib/python2.7/unittest/case.py", line 329, in run
testMethod()
File "/tmp/pkgsrc/textproc/py-lxml/work/lxml-3.5.0/src/lxml/tests/test_io.py", line 278, in test_etree_parse_io_error
self.assertRaises(IOError, self.etree.parse, os.path.join(dn, filename))
File "/opt/local/lib/python2.7/posixpath.py", line 73, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 40: ordinal not in range(128) |
|
Date |
User |
Action |
Args |
2016-01-02 07:42:24 | risto3 | set | recipients:
+ risto3, vstinner, ezio.melotti, akira |
2016-01-02 07:42:24 | risto3 | set | messageid: <1451720544.78.0.033502300781.issue23315@psf.upfronthosting.co.za> |
2016-01-02 07:42:24 | risto3 | link | issue23315 messages |
2016-01-02 07:42:23 | risto3 | create | |
|