py2exe cannot import from six.py
Question: I'm trying use py2exe on a program that imports `urlparse` from
`six.moves.urllib_parse`. Here is the program:

    
    
    # hello.py
    from six.moves.urllib_parse import urlparse
    print('hello world')
    

And here is my setup.py:

    
    
    from distutils.core import setup
    import py2exe
    setup(console=['hello.py'])
    

Running hello.py works fine. When I compile hello.py into an exe using `python
setup.py py2exe`, a `hello.exe` file is produced. However, when I run
`hello.exe` I get an error saying:

`ImportError: No module named urlparse`

I'm using Python 2.7.

With Python 3.4, I get an error saying `KeyError: 'six.moves'` when running
`python setup.py py2exe`.

How can I stop these errors from occurring?


Answer: py2exe released a new version recently that fixes this problem:

    
    
    Changes in version 0.9.2.2:
    - Added support for six, cffi, pycparser, openssl.
    

Using this version I was able to create an .exe and run it successfully.

