Python py2exe "IOError ... unknown url type: https"

So mine Web Scrapper

works fine when working with IDLE / Python, but when I compile it into a single .exe file (using py2exe

) it raises an IOError .

When using a module urllib

:

IOError: [Errno url error] unknown url type: 'https'

      

When using a module requests

:

requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

      

I noticed that when I compiled with py2exe

at the end it said that a few "modules seem to be missing", including a OpenSSL.SSL

few links to urllib

, what could be the problem?

Any ideas, solutions ...?

+3


source to share


2 answers


try this set "skip_archive": True, "unbuffered": True

setup(
      version = "1.0",            
      name = "MyApplication",
      url = "http://www.example.com",
      author = "yourname",
      author_email = "yourname@gmail.com",
      license = "https://www.binpress.com/license/",
      copyright = 'Copyright (c) 2017 MyApplication',
      windows=[{'script': "yourfile.py","icon_resources": [(0, "youricon.ico")],'copyright': "Copyright (c) 2017 MyApplication"}] ,options={'py2exe':{"skip_archive": True,"unbuffered": True,'packages':['Tkinter','PIL','sip','pyavrophonetic','speech_recognition','simplejson','tkSimpleDialog','tkFileDialog','io','tkMessageBox','Tkconstants','random','pyaudio','os','wave','pocketsphinx','sphinxbase','pyttsx']}}
     )
#name your reqired modules

      



then carefully copy the manually skipped files to the dist directory and other files under their respective directory, as you might find some files missing from the modules. Then make an installer for your exe using Inno Setup. Hope this helps. EDIT You can find additional installed modules in type location D:\Python\Lib\site-packages

and most native python modules inD:\Python\Lib

+1


source


Can you check if Windows is installed on your computer openssl

? openssl

is an open source cryptographic library that is used by most * nix systems. I believe the requests and urllibs use the same underlying library.

Once you fix this and then compile, I hope the errors go away.



Note. I am not fully familiar with how you can do this and I do not own a Windows machine to check out some of the articles I found with a google search.

+1


source







All Articles