Errors being generated when converting python code to exe with cx_freeze

0

I did the conversion of the file tucha.py to exe following the instructions and with the following setup.py:

from cx_Freeze import setup, Executable

setup(
    name="tucha EXECUTABLE",
    version = "1.0.0",
    description = ".py to .exe",
    executables = [Executable("tucha.py")])
This is the error I'm getting:
    During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
 File "C:\Users\vinic\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 12, in <module>
__import__(name + "__init__")
File "C:\Users\vinic\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freeze\initscripts\Console.py", line 21, in <module>
scriptModule = __import__(moduleName)
File "tucha.py", line 1, in <module>
File "C:\Users\vinic\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\__init__.py", line 63, in <module>
from . import utils
File "C:\Users\vinic\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\utils.py", line 24, in <module>
from ._internal_utils import to_native_string
File "C:\Users\vinic\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str, str
File "C:\Users\vinic\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\compat.py", line 11, in <module>
from .packages import chardet
File "C:\Users\vinic\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\packages\__init__.py", line 29, in <module>
import urllib3
ImportError: No module named 'urllib3'

To be honest I did not understand very well what is happening, I already looked for in google, but the cases that appear did not solve the problem.

    
asked by anonymous 24.12.2016 / 03:20

1 answer

0

I'm creating a response because I have no reputation to make a comment, I was with a problem very similar and I managed to solve after hours searching on stackoverflow.com. I'm new to Python so I'm sorry if I do not know how to explain it to you the way I understood. If there is a way to publish / edit your tucha.py code or if you can not show the code, please put at least the header so I can try to help you. I will leave here a suggestion of what can help you.

import sys
from cx_Freeze import setup, Executable
import os

build_exe_options = {"packages": ["os","tkinter","tkinter.filedialog","tkinter.messagebox"],
                     "includes": ["reportlab.pdfgen","reportlab.lib.units","subprocess","sqlite3"],
                     }

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "test",
        version = "1.0",
        description = "test application!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("first.py", base=base,icon="icon.ico")])

build_exe_options Sometimes you need to define libraries that you are using in your script, cx_freeze recognizes some, but others need to be manually added.

    
27.01.2017 / 05:27