0

I'm trying to create a python executable for work, and I'm getting a problem with Windows 10 Cmd. I'm not actually sure what the problem is, let alone how to solve it. I've pasted the cmd window below.

The program that I'm trying to make an executable file of, simply takes in some data from an excel doc, takes relevant info and writes a text file. The code works fine when I just run it through Python, but the executable is giving me trouble.

I should just be able to use the command "pyinstaller FileName.py" (without the quotes), but I get these errors.

C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit>pyinstaller --onefile Ex1PyCode.py
104 INFO: PyInstaller: 3.5
105 INFO: Python: 3.8.0
107 INFO: Platform: Windows-10-10.0.17763-SP0
110 INFO: wrote C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\Ex1PyCode.spec
117 INFO: UPX is not available.
117 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Lord Karl\\Desktop\\XLS2CAT_Notes\\Example1_Fruit',
 'C:\\Users\\Lord Karl\\Desktop\\XLS2CAT_Notes\\Example1_Fruit']
133 INFO: checking Analysis
133 INFO: Building Analysis because Analysis-00.toc is non existent
133 INFO: Initializing module dependency graph...
153 INFO: Initializing module graph hooks...
157 INFO: Analyzing base_library.zip ...
8546 INFO: running Analysis Analysis-00.toc
8552 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\python\python.exe
11709 INFO: Caching module hooks...
11720 INFO: Analyzing C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\Ex1PyCode.py
11770 INFO: Processing pre-find module path hook   distutils
13445 INFO: Processing pre-find module path hook   site
13445 INFO: site: retargeting to fake-dir 'c:\\python\\lib\\site-packages\\PyInstaller\\fake-modules'
15396 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
22186 INFO: Processing pre-safe import module hook   six.moves
27347 INFO: Loading module hooks...
27347 INFO: Loading module hook "hook-distutils.py"...
27355 INFO: Loading module hook "hook-encodings.py"...
27497 INFO: Loading module hook "hook-lib2to3.py"...
27497 INFO: Loading module hook "hook-numpy.core.py"...
27744 INFO: Loading module hook "hook-numpy.py"...
27744 INFO: Loading module hook "hook-pandas.py"...
29447 INFO: Loading module hook "hook-pkg_resources.py"...
30197 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
30260 INFO: Processing pre-safe import module hook   win32com
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
30356 INFO: Loading module hook "hook-pydoc.py"...
30356 INFO: Loading module hook "hook-pytz.py"...
30465 INFO: Loading module hook "hook-setuptools.py"...
31231 INFO: Loading module hook "hook-sqlite3.py"...
31358 INFO: Loading module hook "hook-sysconfig.py"...
31358 INFO: Loading module hook "hook-xml.dom.domreg.py"...
31374 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
31374 INFO: Loading module hook "hook-xml.py"...
31467 INFO: Looking for ctypes DLLs
31545 INFO: Analyzing run-time hooks ...
31577 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
31577 INFO: Including run-time hook 'pyi_rth_pkgres.py'
31624 INFO: Looking for dynamic libraries
67758 INFO: Looking for eggs
67759 INFO: Using Python library c:\python\python38.dll
67759 INFO: Found binding redirects:
[]
67799 INFO: Warnings written to C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\build\Ex1PyCode\warn-Ex1PyCode.txt
68189 INFO: Graph cross-reference written to C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\build\Ex1PyCode\xref-Ex1PyCode.html
68361 INFO: checking PYZ
68376 INFO: Building PYZ because PYZ-00.toc is non existent
68376 INFO: Building PYZ (ZlibArchive) C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\build\Ex1PyCode\PYZ-00.pyz
Traceback (most recent call last):
  File "c:\python\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
  File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "C:\Users\Lord Karl\Desktop\XLS2CAT_Notes\Example1_Fruit\Ex1PyCode.spec", line 18, in <module>
    pyz = PYZ(a.pure, a.zipped_data,
  File "c:\python\lib\site-packages\PyInstaller\building\api.py", line 98, in __init__
    self.__postinit__()
  File "c:\python\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
  File "c:\python\lib\site-packages\PyInstaller\building\api.py", line 128, in assemble
    self.code_dict = {
  File "c:\python\lib\site-packages\PyInstaller\building\api.py", line 129, in <dictcomp>
    key: strip_paths_in_code(code)
  File "c:\python\lib\site-packages\PyInstaller\building\utils.py", line 652, in strip_paths_in_code
    consts = tuple(
  File "c:\python\lib\site-packages\PyInstaller\building\utils.py", line 653, in <genexpr>
    strip_paths_in_code(const_co, new_filename)
  File "c:\python\lib\site-packages\PyInstaller\building\utils.py", line 660, in strip_paths_in_code
    return code_func(co.co_argcount, co.co_kwonlyargcount, co.co_nlocals, co.co_stacksize,
TypeError: an integer is required (got type bytes)
6
  • Can you show the error only without posting a photo? Commented Dec 15, 2019 at 20:55
  • There is NOTHING about CMD in your question. All that output is from PYTHON. Nothing from CMD. Both CMD and Python and many other programs are just console programs, they have no relationship with each other. Commented Dec 15, 2019 at 20:56
  • Marios, I copied and pasted the full thing - From my command to the final error. Mark, I deleted the tag. Commented Dec 15, 2019 at 21:01
  • The error about win32com looks significant Commented Dec 15, 2019 at 21:02
  • @Karl did you tried anything from the answers? Commented Dec 16, 2019 at 21:07

2 Answers 2

0

Apparently this was a problem for others as well. I ended up finding my own answer. There is some issue with the fact that Python and Pip were not exactly the same version or something. To fix this, just use the command:

"pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz"

It worked for me after that. I still get the win32com error, but it doesn't seem to be a problem otherwise.

Sign up to request clarification or add additional context in comments.

Comments

0

Install the pywin32 package.

pip install pywin32

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.