On Jaunty: LookupError: unknown encoding: ascii

295 views
Skip to first unread message

Andy Rudoff

unread,
May 20, 2009, 1:20:06 PM5/20/09
to pyins...@googlegroups.com
Hi,

I've been using pyinstaller successfully for a while but after
upgrading my Linux system from Gutsy to Jaunty, my binary now
produces this error:

...
File "linux2/build/pyi.linux2/vm-sitesurvey/outPYZ1.pyz/mylibrary", line 454, in InvokeMethod
File "linux2/build/pyi.linux2/vm-sitesurvey/outPYZ1.pyz/httplib", line 874, in request
File "linux2/build/pyi.linux2/vm-sitesurvey/outPYZ1.pyz/httplib", line 891, in _send_request
File "linux2/build/pyi.linux2/vm-sitesurvey/outPYZ1.pyz/httplib", line 818, in putrequest
LookupError: unknown encoding: ascii

The script works fine running it directly, only the pyinstaller-
created binary produces the error. As you can see, there's a
python module I'm using (shown as "mylibrary" above) which uses
httplib and httplib is throwing the LookupError.

Things I have tried:

- pulling the latest pyinstaller from svn
- searching this mailing list and the web for this issue
- adding a hook-httplib.py to the hooks directory that contains:
hiddenimports = ['encodings.ascii', 'encodings.utf_8']

But none of these have changed the behavior. Ideas?

Thanks much,

-andy

Andy Rudoff

unread,
May 20, 2009, 1:54:28 PM5/20/09
to PyIns...@googlegroups.com
I was able to recreate my issue with a small example. The script
below prints google's main page when run directly, but throws
"LookupError: unknown encoding: ascii" when run through pyinstaller.
And I confirmed that adding encodings.ascii to hiddenimports or
even directly to the script below doesn't fix it.

-andy

#!/usr/bin/python

import httplib

conn = httplib.HTTPConnection('www.google.com')
conn.request('GET', '/')
resp = conn.getresponse()
print resp.read()

Jamie Kirkpatrick

unread,
May 20, 2009, 2:36:33 PM5/20/09
to PyIns...@googlegroups.com
This is a Python 2.6 thing.  2.6 is the default on Jaunty, but PyInstaller does not officially support it.  I have a cheezy hack that makes things work properly: search the bug tracker and you'll find it.

We really do need a Python 2.6 fix sooner rather than later....

2009/5/20 Andy Rudoff <rud...@vmware.com>



--
Jamie Kirkpatrick
07818 422311

Andy Rudoff

unread,
May 20, 2009, 4:33:54 PM5/20/09
to PyIns...@googlegroups.com
>This is a Python 2.6 thing.  2.6 is the default on Jaunty,
>but PyInstaller does not officially support it.
>I have a cheezy hack that makes things work properly:
>search the bug tracker and you'll find it.

Thanks! That's exactly what I needed. I didn't realize PyInstaller
wasn't supporting Python 2.6 yet. To help people in the future who
search for this problem, I'll mention that the Jaunty repository includes
python2.5 so it is pretty easy to give PyInstaller what it is known
to work with:

% sudo apt-get install python2.5 python2.5-dev
(and then use "python2.5" with PyInstaller)

-andy

Giovanni Bajo

unread,
May 22, 2009, 2:57:40 PM5/22/09
to PyIns...@googlegroups.com
On mer, 2009-05-20 at 19:36 +0100, Jamie Kirkpatrick wrote:
> This is a Python 2.6 thing. 2.6 is the default on Jaunty, but
> PyInstaller does not officially support it. I have a cheezy hack that
> makes things work properly: search the bug tracker and you'll find it.

I have just fixed the specific bug reported on this thread (see commit
[671]). I'm not sure if it fixes all the encoding-related problems
though... would you please check again yours?

--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


Reply all
Reply to author
Forward
0 new messages