Skip to content

Crash caused by --name pytz when using --onedir #2697

@mafrosis

Description

@mafrosis

I came across this whilst debugging a thornier issue with pyinstaller/pytz.

It seems there's an issue with naming a pyinstaller build the same as an import. Note the "pytz" name below:

pyinstaller --noconfirm --clean --name pytz --onedir test.py

Using the following simple-as-can-be script test.py

import pytz

def entrypoint():
    print(pytz.timezone('US/Pacific'))

if __name__ == '__main__':
    entrypoint()

Successful with --onefile:

> pyinstaller --noconfirm --clean --name pytz --onefile test.py
139 INFO: PyInstaller: 3.3.dev0+ce364f741
140 INFO: Python: 3.5.3
150 INFO: Platform: Darwin-16.6.0-x86_64-i386-64bit
151 INFO: wrote /private/tmp/pyinst/pytz.spec
155 INFO: UPX is not available.
156 INFO: Removing temporary files and cleaning cache in /Users/mafro/Library/Application Support/pyinstaller
162 INFO: Extending PYTHONPATH with paths
['/private/tmp/pyinst', '/private/tmp/pyinst']
162 INFO: checking Analysis
162 INFO: Building Analysis because out00-Analysis.toc is non existent
163 INFO: Initializing module dependency graph...
164 INFO: Initializing module graph hooks...
166 INFO: Analyzing base_library.zip ...
5346 INFO: running Analysis out00-Analysis.toc
5455 INFO: Caching module hooks...
5459 INFO: Analyzing /private/tmp/pyinst/test2.py
5976 INFO: Processing pre-find module path hook   distutils
7010 INFO: Loading module hooks...
7011 INFO: Loading module hook "hook-xml.py"...
7433 INFO: Loading module hook "hook-pkg_resources.py"...
7804 INFO: Processing pre-safe import module hook   win32com
8283 INFO: Loading module hook "hook-sysconfig.py"...
8285 INFO: Loading module hook "hook-lib2to3.py"...
8294 INFO: Loading module hook "hook-distutils.py"...
8297 INFO: Loading module hook "hook-pytz.py"...
8333 INFO: Loading module hook "hook-encodings.py"...
8440 INFO: Loading module hook "hook-pydoc.py"...
8488 INFO: Looking for ctypes DLLs
8527 INFO: Analyzing run-time hooks ...
8534 INFO: Including run-time hook 'pyi_rth_pkgres.py'
8551 INFO: Looking for dynamic libraries
8671 INFO: Looking for eggs
8671 INFO: Using Python library /Users/mafro/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/Python
8675 INFO: Warnings written to /private/tmp/pyinst/build/pytz/warnpytz.txt
8736 INFO: checking PYZ
8736 INFO: Building PYZ because out00-PYZ.toc is non existent
8736 INFO: Building PYZ (ZlibArchive) /private/tmp/pyinst/build/pytz/out00-PYZ.pyz
9485 INFO: Building PYZ (ZlibArchive) /private/tmp/pyinst/build/pytz/out00-PYZ.pyz completed successfully.
9500 INFO: checking PKG
9500 INFO: Building PKG because out00-PKG.toc is non existent
9501 INFO: Building PKG (CArchive) out00-PKG.pkg
12261 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
12298 INFO: Bootloader /private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/bootloader/Darwin-64bit/run
12298 INFO: checking EXE
12298 INFO: Building EXE because out00-EXE.toc is non existent
12298 INFO: Building EXE from out00-EXE.toc
12298 INFO: Appending archive to EXE /private/tmp/pyinst/dist/pytz
12318 INFO: Fixing EXE for code signing /private/tmp/pyinst/dist/pytz
12323 INFO: Building EXE from out00-EXE.toc completed successfully.

And failing with --onedir:

> pyinstaller --noconfirm --clean --name pytz --onedir test.py
145 INFO: PyInstaller: 3.3.dev0+ce364f741
145 INFO: Python: 3.5.3
151 INFO: Platform: Darwin-16.6.0-x86_64-i386-64bit
152 INFO: wrote /private/tmp/pyinst/pytz.spec
155 INFO: UPX is not available.
157 INFO: Removing temporary files and cleaning cache in /Users/mafro/Library/Application Support/pyinstaller
164 INFO: Extending PYTHONPATH with paths
['/private/tmp/pyinst', '/private/tmp/pyinst']
164 INFO: checking Analysis
164 INFO: Building Analysis because out00-Analysis.toc is non existent
164 INFO: Initializing module dependency graph...
166 INFO: Initializing module graph hooks...
168 INFO: Analyzing base_library.zip ...
5548 INFO: running Analysis out00-Analysis.toc
5561 INFO: Caching module hooks...
5564 INFO: Analyzing /private/tmp/pyinst/test2.py
5879 INFO: Processing pre-find module path hook   distutils
6793 INFO: Loading module hooks...
6794 INFO: Loading module hook "hook-lib2to3.py"...
6798 INFO: Loading module hook "hook-distutils.py"...
6800 INFO: Loading module hook "hook-xml.py"...
7189 INFO: Loading module hook "hook-pkg_resources.py"...
7549 INFO: Processing pre-safe import module hook   win32com
7942 INFO: Loading module hook "hook-pydoc.py"...
7943 INFO: Loading module hook "hook-sysconfig.py"...
7946 INFO: Loading module hook "hook-pytz.py"...
7977 INFO: Loading module hook "hook-encodings.py"...
8103 INFO: Looking for ctypes DLLs
8136 INFO: Analyzing run-time hooks ...
8141 INFO: Including run-time hook 'pyi_rth_pkgres.py'
8153 INFO: Looking for dynamic libraries
8240 INFO: Looking for eggs
8241 INFO: Using Python library /Users/mafro/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/Python
8252 INFO: Warnings written to /private/tmp/pyinst/build/pytz/warnpytz.txt
8316 INFO: checking PYZ
8317 INFO: Building PYZ because out00-PYZ.toc is non existent
8317 INFO: Building PYZ (ZlibArchive) /private/tmp/pyinst/build/pytz/out00-PYZ.pyz
8865 INFO: Building PYZ (ZlibArchive) /private/tmp/pyinst/build/pytz/out00-PYZ.pyz completed successfully.
8877 INFO: checking PKG
8878 INFO: Building PKG because out00-PKG.toc is non existent
8878 INFO: Building PKG (CArchive) out00-PKG.pkg
8887 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
8889 INFO: Bootloader /private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/bootloader/Darwin-64bit/run
8889 INFO: checking EXE
8889 INFO: Building EXE because out00-EXE.toc is non existent
8889 INFO: Building EXE from out00-EXE.toc
8889 INFO: Appending archive to EXE /private/tmp/pyinst/build/pytz/pytz
8890 INFO: Fixing EXE for code signing /private/tmp/pyinst/build/pytz/pytz
8895 INFO: Building EXE from out00-EXE.toc completed successfully.
8898 INFO: checking COLLECT
8898 INFO: Building COLLECT because out00-COLLECT.toc is non existent
8898 INFO: Building COLLECT out00-COLLECT.toc
Traceback (most recent call last):
  File "/private/tmp/pyinst/bin/pyinstaller", line 11, in <module>
    load_entry_point('PyInstaller==3.3.dev0+ce364f741', 'console_scripts', 'pyinstaller')()
  File "/private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/__main__.py", line 87, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/__main__.py", line 45, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 788, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 734, in build
    exec(text, spec_namespace)
  File "<string>", line 33, in <module>
  File "/private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/building/api.py", line 654, in __init__
    self.__postinit__()
  File "/private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/building/datastruct.py", line 161, in __postinit__
    self.assemble()
  File "/private/tmp/pyinst/lib/python3.5/site-packages/PyInstaller/building/api.py", line 682, in assemble
    os.makedirs(todir)
  File "/Users/mafro/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/os.py", line 231, in makedirs
    makedirs(head, mode, exist_ok)
  File "/Users/mafro/.pyenv/versions/3.5.3/Python.framework/Versions/3.5/lib/python3.5/os.py", line 241, in makedirs
    mkdir(name, mode)
NotADirectoryError: [Errno 20] Not a directory: '/private/tmp/pyinst/dist/pytz/pytz/zoneinfo'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions