3

So my Web Scrapper works fine when ran with IDLE/Python, but when I compile it into a single .exe file (using py2exe), it raises an IOError.

When using urllib module:

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

When using requests module:

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

I did notice, when compiling with py2exe, it said at the end that several "modules appear to be missing", including a OpenSSL.SSL, and several references to urllib, which might be the problem?

Any ideas, solutions...?

JRG
  • 4,037
  • 3
  • 23
  • 34
Chris Nguyen
  • 160
  • 1
  • 4
  • 14
  • Could you compile it again and paste the errors given? You could also give another compiler a try - fx pyinstaller. You compile with that like so from command promt (and given you're at the place pyinstaller resides): pyinstaller --onefile path_to_file_that_needs_compiling – jlaur Jul 06 '17 at 19:10
  • @jlaur Hey, just used PyInstaller and for some reason it works now. All other compilers failed, but that one worked...Weird... – Chris Nguyen Aug 24 '17 at 20:02

2 Answers2

1

try this out 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 paste the files said missing manually to under dist directory and other files under their respective directory as you can find some files missing under modules. Then make an installer for your exe using Inno Setup. Hope this helps. EDIT You can find extra installed modules in location likeD:\Python\Lib\site-packages and most of python's own modules in D:\Python\Lib

  • Well First thing, I have no idea what I'm missing or where to find them. For there are like 30 some module "missing" – Chris Nguyen Jul 09 '17 at 17:46
1

Can you check if you have openssl installed on your Windows machine? openssl is an open source cryptographic library which is used by most *nix systems. I believe that requests and urllib uses the same underlying library.

Once you fix this and then compile, I'm hoping the errors go away.

Note: I am not fully familiar with how you can do it and I do not own a Windows machine to test some of the articles I found via Google search.

Adi Krishnan
  • 155
  • 8