#57: Encoding problems
-------------------------+--------------------------------------------------
 Reporter:  openticket   |       Owner:  giovannibajo   
     Type:  defect       |      Status:  new            
 Priority:  normal       |   Milestone:  PyInstaller 1.4
Component:  PyInstaller  |     Version:                 
 Severity:  major        |    Keywords:                 
-------------------------+--------------------------------------------------
 Numerous recent threads appear to point to some problem with handling
 encodings, for example:

 http://groups.google.com/group/PyInstaller/t/3ac5727d3b751401

 http://groups.google.com/group/PyInstaller/t/c1cf872963c50f98

 I've tried to reproduce the problem with a minimal test case. The
 following script:

 {{{
 import encodings

 def main():
     print encodings
     print dir(encodings)
     print encodings.utf_8
     print repr(u'\u2029'.encode('utf-8'))

 if __name__ == "__main__":
     main()
 }}}

 is run through Build.py to create a --onefile executable. When this is run
 on the build system (Ubuntu Jaunty/python2.6) ''as a script'', we get the
 following output:

 {{{
 <module 'encodings' from '/usr/lib/python2.6/encodings/__init__.pyc'>
 ['CodecRegistryError', '__builtin__', '__builtins__', '__doc__',
 '__file__',
 '__name__', '__package__', '__path__', '_aliases', '_cache',
 '_import_tail',
 '_norm_encoding_map', '_unknown', 'aliases', 'codecs',
 'normalize_encoding', 'search_function', 'utf_8']
 <module 'encodings.utf_8' from '/usr/lib/python2.6/encodings/utf_8.pyc'>
 '\xe2\x80\xa9'
 }}}

 Which seems to be as expected. When run on the build system ''as an
 executable'', we get the following output:

 {{{
 <module 'encodings' from '/usr/lib/python2.6/encodings/__init__.pyc'>
 ['CodecRegistryError', '__builtin__', '__builtins__', '__doc__',
 '__file__',
 '__name__', '__package__', '__path__', '_aliases', '_cache',
 '_import_tail',
 '_norm_encoding_map', '_unknown', 'aliases', 'codecs',
 'normalize_encoding', 'search_function', 'utf_8']
 <module 'encodings.utf_8' from '/usr/lib/python2.6/encodings/utf_8.pyc'>
 '\xe2\x80\xa9'
 }}}

 which again doesn't seem unreasonable. However, copying the executable to
 a different system (Ubuntu Hardy/python2.5) and running it there gives the
 following output:

 {{{
 <module 'encodings' from
 '/home/vinay/projects/py_scratch/build/pyi.linux2/munge/outPYZ1.pyz/encodings'>
 ['CodecRegistryError', '__builtin__', '__builtins__', '__doc__',
 '__file__',
 '__importsub__', '__name__', '__package__', '__path__', '_aliases',
 '_cache', '_import_tail',
 '_norm_encoding_map', '_unknown', 'aliases', 'codecs',
 'normalize_encoding', 'search_function']
 Traceback (most recent call last):
   File "<string>", line 10, in <module>
   File "<string>", line 6, in main
 AttributeError: 'module' object has no attribute 'utf_8'
 }}}

 Now fails, because for whatever reason, 'utf_8' has not been auto-imported
 as it was in the two previous cases. The same error occurs when building
 on Ubuntu Hardy/python2.5 and copying to Ubuntu Jaunty/python2.6.

 I've confirmed that outPYZ1.pyz does appear to contain ascii and utf-8
 (and a whole bunch of other) encodings - see the complete list in ticket
 #56. Now there is a bit of an overlap with #56 so it's probably best to
 treat that as the "spurious messages" issue, and this one can be about the
 problem with handling encodings.

-- 
Ticket URL: <http://www.pyinstaller.org/ticket/57>
Pyinstaller <http://www.pyinstaller.org>
PyInstaller Project
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to