Skip to content

"Cannot open self" after running pyi-set_version.exe #3466

@keithzg

Description

@keithzg

I have a single-file script that I'm using pyinstaller to turn into a Windows exe file. It runs perfectly fine:

C:\svn\T220>dist\xlsx2csv\xlsx2csv.exe
Invalid Arguments. Usage: xlsx2csv <database> <folder for output [optional, should default to exe folder]>

until I run pyi-set_version.exe to embed version info:

C:\svn\T220>pyi-set_version.exe text.txt dist/xlsx2csv/xlsx2csv.exe
Version info set in: C:\svn\T220\dist\xlsx2csv\xlsx2csv.exe

C:\svn\T220>dist\xlsx2csv\xlsx2csv.exe
[3164] Cannot open self C:\svn\T220\dist\xlsx2csv\xlsx2csv.exe or archive C:\svn\T220\dist\xlsx2csv\xlsx2csv.pkg

I've installed the current development version of pyinstaller and run pyi-archive_viewer.exe against it, and it seems fine before I run pyi-set_version.exe, and fails afterwards:

C:\svn\T220>pyinstaller xlsx2csv.py
54 INFO: PyInstaller: 3.4.dev0+ab8fd9753
54 INFO: Python: 3.6.3
56 INFO: Platform: Windows-10-10.0.14393-SP0
59 INFO: wrote C:\svn\T220\xlsx2csv.spec
60 INFO: UPX is not available.
61 INFO: Extending PYTHONPATH with paths
['C:\\svn\\T220', 'C:\\svn\\T220']
62 INFO: checking Analysis
71 INFO: checking PYZ
79 INFO: checking PKG
80 INFO: Bootloader c:\python36-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
81 INFO: checking EXE
82 INFO: checking COLLECT
WARNING: The output directory "C:\svn\T220\dist\xlsx2csv" and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)y
2221 INFO: Removing dir C:\svn\T220\dist\xlsx2csv
2262 INFO: Building COLLECT out00-COLLECT.toc
2512 INFO: Building COLLECT out00-COLLECT.toc completed successfully.


C:\svn\T220>pyi-archive_viewer dist\xlsx2csv\xlsx2csv.exe
 pos, length, uncompressed, iscompressed, type, name
[(0, 248, 312, 1, 'm', 'struct'),
 (248, 1103, 1803, 1, 'm', 'pyimod01_os_path'),
 (1351, 4287, 9257, 1, 'm', 'pyimod02_archive'),
 (5638, 7218, 18478, 1, 'm', 'pyimod03_importers'),
 (12856, 1859, 4171, 1, 's', 'pyiboot01_bootstrap'),
 (14715, 2128, 3302, 1, 's', 'xlsx2csv'),
 (16843, 1284264, 1284264, 0, 'z', 'out00-PYZ.pyz')]
? Aborted by user request.

C:\svn\T220>pyi-set_version.exe text.txt dist/xlsx2csv/xlsx2csv.exe
Version info set in: C:\svn\T220\dist\xlsx2csv\xlsx2csv.exe

C:\svn\T220>pyi-archive_viewer dist\xlsx2csv\xlsx2csv.exe
Traceback (most recent call last):
  File "C:\Python36-32\Scripts\pyi-archive_viewer-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.4.dev0+ab8fd9753', 'console_scripts', 'pyi-archive_viewer')()
  File "c:\python36-32\lib\site-packages\PyInstaller\utils\cliutils\archive_viewer.py", line 261, in run
    raise SystemExit(main(**vars(args)))
  File "c:\python36-32\lib\site-packages\PyInstaller\utils\cliutils\archive_viewer.py", line 40, in main
    arch = get_archive(name)
  File "c:\python36-32\lib\site-packages\PyInstaller\utils\cliutils\archive_viewer.py", line 129, in get_archive
    return CArchiveReader(name)
  File "c:\python36-32\lib\site-packages\PyInstaller\archive\readers.py", line 130, in __init__
    super(CArchiveReader, self).__init__(archive_path, start)
  File "c:\python36-32\lib\site-packages\PyInstaller\loader\pyimod02_archive.py", line 163, in __init__
    self.checkmagic()
  File "c:\python36-32\lib\site-packages\PyInstaller\archive\readers.py", line 153, in checkmagic
    (self.path, self.__class__.__name__))
RuntimeError: dist\xlsx2csv\xlsx2csv.exe is not a valid CArchiveReader archive file

The text.txt file I'm testing with there is https://raw.githubusercontent.com/pyinstaller/pyinstaller/develop/tests/old_suite/basic/test_pkg_structures-version.txt. Originally I was using a self-generated one created from using pyi-get_version from a py2exe-compiled version of this script (I'm trying to change over from py2exe to pyinstaller). In both cases, the file fails to run after the version info is added, but the version info is reported correctly by Windows afterwards.

I'd really like to switch over to using pyinstaller for this project rather than old py2exe, but including version info is important for it, so I hope this can be solved somehow!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions