Problem with pyinstaller

615 views
Skip to first unread message

Sebastian Ulanowski

unread,
Jul 8, 2021, 10:23:28 AM7/8/21
to VPython-users

Hi all,
could you please help me with that? I will be grateful. I'm new in programming world, with pyinstaller too :-(

I have wrote a script which i would like to have as an executable file.
After running pyinstaller, i received below errors, i do not know where to start :-((((
Please help if you can
Regards
Sebastian

C:\Projects\Call_Control>pyinstaller --onefile Welcome_Call_Control.py
148 INFO: PyInstaller: 4.3
148 INFO: Python: 3.8.5
152 INFO: Platform: Windows-10-10.0.17134-SP0
159 INFO: wrote C:\Projects\Call_Control\Welcome_Call_Control.spec
169 INFO: UPX is not available.
194 INFO: Extending PYTHONPATH with paths
['C:\\Projects\\Call_Control', 'C:\\Projects\\Call_Control']
232 INFO: checking Analysis
232 INFO: Building Analysis because Analysis-00.toc is non existent
235 INFO: Initializing module dependency graph...
252 INFO: Caching module graph hooks...
347 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
5018 INFO: Processing pre-find module path hook distutils from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
5020 INFO: distutils: retargeting to non-venv dir 'c:\\python\\lib'
9722 INFO: Caching module dependency graph...
9932 INFO: running Analysis Analysis-00.toc
9990 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\python\python.exe
10307 INFO: Analyzing C:\Projects\Call_Control\Welcome_Call_Control.py
14705 INFO: Processing pre-find module path hook site from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
14707 INFO: site: retargeting to fake-dir 'c:\\python\\lib\\site-packages\\PyInstaller\\fake-modules'
23694 INFO: Processing module hooks...
23694 INFO: Loading module hook 'hook-bcrypt.py' from 'c:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
23698 INFO: Loading module hook 'hook-cryptography.py' from 'c:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
24415 INFO: Loading module hook 'hook-nacl.py' from 'c:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
24460 INFO: Loading module hook 'hook-pycparser.py' from 'c:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
24462 INFO: Loading module hook 'hook-pytest.py' from 'c:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
25481 INFO: Loading module hook 'hook-pywintypes.py' from 'c:\\python\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "c:\python\lib\site-packages\PyInstaller\__init__.py", line 18, in <module>
    from . import compat
  File "c:\python\lib\site-packages\PyInstaller\compat.py", line 19, in <module>
    import platform
  File "c:\python\lib\platform.py", line 117, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
26229 INFO: Loading module hook 'hook-difflib.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
26236 INFO: Loading module hook 'hook-distutils.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
26238 INFO: Loading module hook 'hook-distutils.util.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
26249 INFO: Loading module hook 'hook-encodings.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
26613 INFO: Loading module hook 'hook-heapq.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
26619 INFO: Loading module hook 'hook-lib2to3.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
26861 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
26867 INFO: Loading module hook 'hook-packaging.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
26869 INFO: Loading module hook 'hook-pickle.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
26878 INFO: Loading module hook 'hook-pkg_resources.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
27676 WARNING: Hidden import "pkg_resources.py2_warn" not found!
27677 WARNING: Hidden import "pkg_resources.markers" not found!
27682 INFO: Loading module hook 'hook-pygments.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
28742 INFO: Loading module hook 'hook-setuptools.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
29295 INFO: Import to be excluded not found: 'setuptools.py33compat'
29295 INFO: Import to be excluded not found: 'setuptools.py27compat'
29298 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
29308 INFO: Loading module hook 'hook-win32ctypes.core.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "c:\python\lib\traceback.py", line 5, in <module>
    import linecache
  File "c:\python\lib\linecache.py", line 11, in <module>
    import tokenize
  File "c:\python\lib\tokenize.py", line 32, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
30001 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
30003 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
30006 INFO: Loading module hook 'hook-xml.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
30015 INFO: Loading module hook 'hook-_tkinter.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\python\lib\tkinter\__init__.py", line 39, in <module>
    import re
  File "c:\python\lib\re.py", line 145, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
30702 ERROR: Tcl/Tk improperly installed on this system.
30705 INFO: Loading module hook 'hook-setuptools.msvc.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
30753 INFO: Looking for ctypes DLLs
30834 INFO: Analyzing run-time hooks ...
30843 INFO: Including run-time hook 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
30850 INFO: Including run-time hook 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
30879 INFO: Looking for dynamic libraries
31153 INFO: Cannot get manifest resource from non-PE file venv\Lib\site-packages\pycparser\ply\ctokens.py
31154 WARNING: Can not get binary dependencies for file: venv\Lib\site-packages\pycparser\ply\ctokens.py
31156 WARNING:   Reason: 'DOS Header magic not found.'
31194 INFO: Cannot get manifest resource from non-PE file venv\Lib\site-packages\nacl\bindings\crypto_scalarmult.py
31196 WARNING: Can not get binary dependencies for file: venv\Lib\site-packages\nacl\bindings\crypto_scalarmult.py
31206 WARNING:   Reason: 'DOS Header magic not found.'
31218 INFO: Cannot get manifest resource from non-PE file venv\Lib\site-packages\idna\__pycache__\core.cpython-38.pyc
31225 WARNING: Can not get binary dependencies for file: venv\Lib\site-packages\idna\__pycache__\core.cpython-38.pyc
31225 WARNING:   Reason: 'DOS Header magic not found.'
31257 INFO: Cannot get manifest resource from non-PE file venv\Lib\site-packages\pip\_vendor\urllib3\util\url.py
31258 WARNING: Can not get binary dependencies for file: venv\Lib\site-packages\pip\_vendor\urllib3\util\url.py
31260 WARNING:   Reason: 'DOS Header magic not found.'
31276 INFO: Cannot get manifest resource from non-PE file venv\Lib\site-packages\py\_log\warning.py
31279 WARNING: Can not get binary dependencies for file: venv\Lib\site-packages\py\_log\warning.py
31286 WARNING:   Reason: 'DOS Header magic not found.'
31308 INFO: Cannot get manifest resource from non-PE file venv\Lib\site-packages\pip\_vendor\html5lib\treebuilders\dom.py
31309 WARNING: Can not get binary dependencies for file: venv\Lib\site-packages\pip\_vendor\html5lib\treebuilders\dom.py
31311 WARNING:   Reason: 'DOS Header magic not found.'
31331 INFO: Cannot get manifest resource from non-PE file venv\Lib\site-packages\pip\_internal\operations\freeze.py
31332 WARNING: Can not get binary dependencies for file: venv\Lib\site-packages\pip\_internal\operations\freeze.py
31340 WARNING:   Reason: 'DOS Header magic not found.'
31361 INFO: Cannot get manifest resource from non-PE file venv\Lib\site-packages\cryptography\x509\certificate_transparency.py
31362 WARNING: Can not get binary dependencies for file: venv\Lib\site-packages\cryptography\x509\certificate_transparency.py
31362 WARNING:   Reason: 'DOS Header magic not found.'
Traceback (most recent call last):
  File "c:\python\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
    yield
  File "c:\python\lib\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
    return _dll._LoadLibraryEx(fileName, 0, flags)
  File "c:\python\lib\site-packages\win32ctypes\core\cffi\_dll.py", line 23, in _LoadLibraryEx
    result = check_null(
  File "c:\python\lib\site-packages\win32ctypes\core\cffi\_util.py", line 81, in __call__
    self._raise_error(function_name)
  File "c:\python\lib\site-packages\win32ctypes\core\cffi\_util.py", line 92, in _raise_error
    raise exception
OSError: [WinError 1006] The volume for a file has been externally altered so that the opened file is no longer valid

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 65, 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 737, 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 684, in build
    exec(code, spec_namespace)
  File "C:\Projects\Call_Control\Welcome_Call_Control.spec", line 7, in <module>
    a = Analysis(['Welcome_Call_Control.py'],
  File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
    self.__postinit__()
  File "c:\python\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
  File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 467, in assemble
    self.binaries.extend(bindepend.Dependencies(self.binaries,
  File "c:\python\lib\site-packages\PyInstaller\depend\bindepend.py", line 224, in Dependencies
    for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):
  File "c:\python\lib\site-packages\PyInstaller\depend\bindepend.py", line 403, in getAssemblyFiles
    for assembly in getAssemblies(pth):
  File "c:\python\lib\site-packages\PyInstaller\depend\bindepend.py", line 354, in getAssemblies
    res = GetManifestResources(pth)
  File "c:\python\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1016, in GetManifestResources
    return winresource.GetResources(filename, [RT_MANIFEST], names, languages)
  File "c:\python\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 170, in GetResources
    hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
  File "c:\python\lib\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
    return _dll._LoadLibraryEx(fileName, 0, flags)
  File "c:\python\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\python\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
    raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (1006, 'LoadLibraryEx', 'The volume for a file has been externally altered so that the opened file is no longer valid')

Bruce Sherwood

unread,
Jul 8, 2021, 1:13:43 PM7/8/21
to VPython-users
I know nothing about pyinstaller, but I'll ask: Is the script that you are trying to make into an executable a VPython program? If so, there are two alternatives if pyinstaller can't do the job: 

1) Use the binder mechanism (here is an example: 

2) If your program imports only the vpython module, your program can run at glowscript.org and can also be exported from glowscript.org as converted JavaScript code that can be placed in a web site (https://brucesherwood.net/?p=191 is an example of a VPython program embedded in a Wordpress document).

Bruce
Reply all
Reply to author
Forward
0 new messages