Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
distutils bdist_wininst failure on Linux
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Steven D'Aprano  
View profile  
 More options Feb 23, 9:06 am
Newsgroups: comp.lang.python
From: Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>
Date: 23 Feb 2012 14:06:22 GMT
Local: Thurs, Feb 23 2012 9:06 am
Subject: distutils bdist_wininst failure on Linux
Following instructions here:

http://docs.python.org/py3k/distutils/builtdist.html#creating-windows...

I am trying to create a Windows installer for a pure-module distribution
using Python 3.2. I get a "LookupError: unknown encoding: mbcs"

Here is the full output of distutils and the traceback:

[steve@ando pyprimes]$ python3.2 setup.py bdist_wininst
running bdist_wininst
running build
running build_py
creating build/lib
copying src/pyprimes.py -> build/lib
installing to build/bdist.linux-i686/wininst
running install_lib
creating build/bdist.linux-i686/wininst
creating build/bdist.linux-i686/wininst/PURELIB
copying build/lib/pyprimes.py -> build/bdist.linux-i686/wininst/PURELIB
running install_egg_info
Writing build/bdist.linux-i686/wininst/PURELIB/pyprimes-0.1.1a-py3.2.egg-info
creating '/tmp/tmp3utw4_.zip' and adding '.' to it
adding 'PURELIB/pyprimes.py'
adding 'PURELIB/pyprimes-0.1.1a-py3.2.egg-info'
creating dist
Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules winreg, win32api or win32con are installed.
Traceback (most recent call last):
  File "setup.py", line 60, in <module>
    "License :: OSI Approved :: MIT License",
  File "/usr/local/lib/python3.2/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.2/distutils/dist.py", line 917, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.2/distutils/dist.py", line 936, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.2/distutils/command/bdist_wininst.py", line 179, in run
    self.create_exe(arcname, fullname, self.bitmap)
  File "/usr/local/lib/python3.2/distutils/command/bdist_wininst.py", line 262, in create_exe
    cfgdata = cfgdata.encode("mbcs")
LookupError: unknown encoding: mbcs

How do I fix this, and is it a bug in distutils?

--
Steven


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jmfauth  
View profile  
 More options Feb 23, 10:09 am
Newsgroups: comp.lang.python
From: jmfauth <wxjmfa...@gmail.com>
Date: Thu, 23 Feb 2012 07:09:35 -0800 (PST)
Local: Thurs, Feb 23 2012 10:09 am
Subject: Re: distutils bdist_wininst failure on Linux
On 23 fév, 15:06, Steven D'Aprano <steve

Because the 'mbcs' codec is missing in your Linux, :-)

>>> 'abc需'.encode('cp1252')
b'abc\xe9\x9c\x80'
>>> 'abc需'.encode('missing')

Traceback (most recent call last):
  File "<eta last command>", line 1, in <module>
LookupError: unknown encoding: missing

jmf


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Feb 23, 7:11 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>
Date: 24 Feb 2012 00:11:11 GMT
Local: Thurs, Feb 23 2012 7:11 pm
Subject: Re: distutils bdist_wininst failure on Linux

On Thu, 23 Feb 2012 07:09:35 -0800, jmfauth wrote:
> On 23 fév, 15:06, Steven D'Aprano <steve
> +comp.lang.pyt...@pearwood.info> wrote:
>> Following instructions here:

>> http://docs.python.org/py3k/distutils/builtdist.html#creating-
windows...

>> I am trying to create a Windows installer for a pure-module
>> distribution using Python 3.2. I get a "LookupError: unknown encoding:
>> mbcs"
[...]
>> How do I fix this, and is it a bug in distutils?

> Because the 'mbcs' codec is missing in your Linux, :-)

Well duh :-)

This is a bug in distutils. Prompted by your comment I expanded my search
terms and found this bug report:

http://bugs.python.org/issue10945

The problem is that mbcs is not a real codec, it means "whatever codec is
currently configured in Windows". So it doesn't exist on non-Windows
platforms. But distutils bdist_wininst is explicitly documented as
working on non-Windows platforms. Hence, it's a bug.

--
Steven


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven D'Aprano  
View profile  
 More options Feb 23, 7:49 pm
Newsgroups: comp.lang.python
From: Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>
Date: 24 Feb 2012 00:49:11 GMT
Local: Thurs, Feb 23 2012 7:49 pm
Subject: Re: distutils bdist_wininst failure on Linux

And I have a work-around that seems to work for me. Put this at the top
of your setup.py install script:

# Work around mbcs bug in distutils.
# http://bugs.python.org/issue10945
import codecs
try:
    codecs.lookup('mbcs')
except LookupError:
    ascii = codecs.lookup('ascii')
    func = lambda name, enc=ascii: {True: enc}.get(name=='mbcs')
    codecs.register(func)

--
Steven


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »