unknown encoding: ASCII problem

Bug #899066 reported by Atilla Öntaş
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Medium
Unassigned

Bug Description

Python : sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0)
lxml.etree : (2, 3, 2, 0)
libxml used : (2, 7, 8)
libxml compiled : (2, 7, 8)
libxslt used : (1, 1, 26)
libxslt compiled : (1, 1, 26)

I' m trying to install and run virtaal (a translation app.) and it uses lxml on an Archlinux box. I have latest python-xml installed, on a KDE desktop with tr_TR.UTF-8 encoding (turkish). When i try to run setup.py to install virtaal; it throws this:

running build_scripts
running install
sh: /root/.config/qtcurve/gtk-icons.4416: Erişim engellendi
Traceback (most recent call last):
  File "./setup.py", line 603, in <module>
    main(options)
  File "./setup.py", line 600, in main
    **options)
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "./setup.py", line 573, in run
    failed = depcheck.check_dependencies()
  File
"/home/atilla/DEPOM/Archlinux/PKGBUILDS/virtaal/src/virtaal-0.7.0/virtaal/support/depcheck.py",
line 98, in check_dependencies
    elif not test_import(name):
  File
"/home/atilla/DEPOM/Archlinux/PKGBUILDS/virtaal/src/virtaal-0.7.0/virtaal/support/depcheck.py",
line 86, in test_import
    __import__(modname, {}, {}, [])
  File "lxml.etree.pyx", line 239, in init lxml.etree
(src/lxml/lxml.etree.c:160637)
  File "lxml.etree.pyx", line 201, in lxml.etree.__unpackDottedVersion
(src/lxml/lxml.etree.c:6549)
LookupError: unknown encoding: ASCII

I have workaround this issue by exporting env LC_ALL=C . While it is installed correctly virtaal won't run and throw same error:

$ /usr/bin/virtaal

Traceback (most recent call last):
  File "/usr/bin/virtaal", line 56, in <module>
    failed = depcheck.check_dependencies(depcheck.import_checks + optional_modules)
  File "/usr/lib/python2.7/site-packages/virtaal/support/depcheck.py", line 98, in check_dependencies
    elif not test_import(name):
  File "/usr/lib/python2.7/site-packages/virtaal/support/depcheck.py", line 86, in test_import
    __import__(modname, {}, {}, [])
  File "lxml.etree.pyx", line 239, in init lxml.etree (src/lxml/lxml.etree.c:160637)
  File "lxml.etree.pyx", line 201, in lxml.etree.__unpackDottedVersion (src/lxml/lxml.etree.c:6549)
LookupError: unknown encoding: ASCII

I have searched this and see only Turkish users have faced this problem. Also my searchs indicate that this error may be a lxml error rather than virtaal bug. I have reported this issue to virtaal developres as well : http://bugs.locamotion.org/show_bug.cgi?id=2072

Revision history for this message
scoder (scoder) wrote :

Do you mean "python-xml" or "python-lxml"? The first is likely to be a dead package containing "PyXML". You don't need that.

Regarding the "ASCII" encoding - it seems that the best name for CPython to see is "ascii", in lower case. libxml2 prefers the upper case names, that's why Ixml had used those internally. Normally, CPython also gets along with the upper case names nicely, so I wonder what the problem is on your side. Maybe some Archlinux specifc issue?

I pushed a fix here:

https://github.com/lxml/lxml/commit/90b0b10743b89ec4e0533a9ebca42715f0054366

If you want to try it, you need Cython 0.15 to build from sources.

Changed in lxml:
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
Atilla Öntaş (tarakbumba) wrote :

Thank you for quick reply. I indeed mean python-lxml and this is not an Arch specific issue and appears to be only Turkish users affected from this. May be our big i letter with dot is the main problem :

https://qa.mandriva.com/show_bug.cgi?id=48995#c7 - Mandriva (although old but it still here, unless your fix works)
http://forum.linuxmint.org.tr/index.php?topic=2581.0 (Linux Mint)

I will try the patch and report here.

Revision history for this message
Atilla Öntaş (tarakbumba) wrote :

Thank you again. I have compiled git branch and seems problem fixed. I' ll report this to virtaal developers. Thank you again.

Revision history for this message
scoder (scoder) wrote :

Fixed in lxml 2.3.3.

Changed in lxml:
status: Fix Committed → Fix Released
scoder (scoder)
Changed in lxml:
milestone: none → 2.3.x
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.