Search code examples
python-2.7lxmlpython-requestspy2execlint

Py2exe requests, Clint, LXML


My setup.py throws the following error when trying to make my py2exe setup script

The following modules appear to be missing
['OpenSSL.SSL', '_scproxy', 'backports.ssl_match_hostname', 'builtins', 'certifi', 'clint.textui.puts', 'http', 'http.client', 'http.cookies', 'ndg.httpsclient.ssl_peer_verification', 'ndg.httpsclient.subj_alt_
name', 'packages.ssl_match_hostname.CertificateError', 'packages.ssl_match_hostname.match_hostname', 'packages.urllib3.Retry', 'packages.urllib3.util.Timeout', 'packages.urllib3.util.parse_url', 'pyasn1.codec.d

What am i missing from my setup.py so it will work ?

from setuptools import setup
from sys import version

try:
    import py2exe
except ImportError:
    print "Warning: py2exe is not installed."
    print "(Though it may not be available on your platform.)"

requires = ['requests', 'clint', 'lxml']
if version < '2.6.0':
    requires.append("simplejson")

setup(
    name='CFSRESD',
    version='0.1',
    author='Shane Rees',
    url='http://github.com/Shaggs/cfsresd',
    options=dict(py2exe=dict(includes=['scraper'])),

    requires= requires,
    license='GPL3',
    console=['daemon.py']
    )

and here is the top my daemon.py script

from scraper import Scraper
import sys
import requests
from clint.textui import puts, colored

I thought that my setup.py was correct but appears not.

Any Ideas ?


Solution

  • Instead of py2exe use pyinstaller

    Pyinstaller.exe -F script.py
    

    -F means one file

    Since you are using requests might have to do

    pyinstaller.exe -F --hidden-import=requests script.py
    

    Give that a shot