Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pyinstaller funktioniert nicht mehr

188 views
Skip to first unread message

Ulli Horlacher

unread,
Nov 18, 2021, 4:56:58 AM11/18/21
to
Arbeitet hier jemand mit pyinstaller?

Vor 5 Jahren hatte ich noch unter Windows 7 mit pyinstaller Python2
Programme compiliert. Das hatte gut funktioniert, es ist ein stand-alone
exe herausgekommen.

Ich hab das nun mit Python3 und Windows 10 wieder probiert. Da
funktioniert das nicht mehr. Ich bekomme:


P:\W10>pyinstaller.exe --onefile fextasy.py
140 INFO: PyInstaller: 4.7
140 INFO: Python: 3.10.0
171 INFO: Platform: Windows-10-10.0.19041-SP0
171 INFO: wrote P:\W10\fextasy.spec
171 INFO: UPX is not available.
218 INFO: Extending PYTHONPATH with paths
['P:\\W10']
656 INFO: checking Analysis
(...)
23858 INFO: Copying icons from ['C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico']
23999 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
23999 INFO: Writing RT_ICON 1 resource with 3752 bytes
23999 INFO: Writing RT_ICON 2 resource with 2216 bytes
23999 INFO: Writing RT_ICON 3 resource with 1384 bytes
23999 INFO: Writing RT_ICON 4 resource with 37019 bytes
23999 INFO: Writing RT_ICON 5 resource with 9640 bytes
23999 INFO: Writing RT_ICON 6 resource with 4264 bytes
23999 INFO: Writing RT_ICON 7 resource with 1128 bytes
Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
yield
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource
_resource._EndUpdateResource(handle, discard)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\win32ctypes\core\ctypes\_util.py", line 64, in check_false
raise make_error(function, function_name)
OSError: [WinError 110] The system cannot open the device or file specified.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 124, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py", line 58, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 782, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 714, in build
exec(code, spec_namespace)
File "P:\W10\fextasy.spec", line 23, in <module>
exe = EXE(pyz,
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\api.py", line 507, in __init__
self.__postinit__()
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\datastruct.py", line 155, in __postinit__
self.assemble()
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\api.py", line 603, in assemble
icon.CopyIcons(self.name, self.icon)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\utils\win32\icon.py", line 208, in CopyIcons
return CopyIcons_FromIco(dstpath, [srcpath])
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\utils\win32\icon.py", line 158, in CopyIcons_FromIco
win32api.EndUpdateResource(hdst, 0)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\win32ctypes\pywin32\win32api.py", line 228, in EndUpdateResource
with _pywin32error():
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (110, 'EndUpdateResourceW', 'The system cannot open the device or file specified.')


Da meine Windows-Kenntnisse gegen Null tendieren, kann ich mit den
Fehlermeldungen nichts anfangen. Was geht da schief?


--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart E-Mail: horl...@tik.uni-stuttgart.de
Allmandring 30a Tel: ++49-711-68565868
70569 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/

Peter Heitzer

unread,
Nov 18, 2021, 6:21:04 AM11/18/21
to
Ulli Horlacher <fram...@rus.uni-stuttgart.de> wrote:
>Arbeitet hier jemand mit pyinstaller?

>Vor 5 Jahren hatte ich noch unter Windows 7 mit pyinstaller Python2
>Programme compiliert. Das hatte gut funktioniert, es ist ein stand-alone
>exe herausgekommen.

>Ich hab das nun mit Python3 und Windows 10 wieder probiert. Da
>funktioniert das nicht mehr. Ich bekomme:


>P:\W10>pyinstaller.exe --onefile fextasy.py
>140 INFO: PyInstaller: 4.7
>140 INFO: Python: 3.10.0
>171 INFO: Platform: Windows-10-10.0.19041-SP0
>171 INFO: wrote P:\W10\fextasy.spec
>171 INFO: UPX is not available.
Vielleicht liegt es daran. Wie soll pyinstaller eine Exe erstellen, wenn
der Packer nicht vorhanden ist.

In meiner Windows 10 VM hat allerdings ein einfaches Skript mit etwas
Tk GUI funktioniert.
Probier mal ein triviales Skript mit print('Hello') aus.

--
Dipl.-Inform(FH) Peter Heitzer, peter....@rz.uni-regensburg.de

Ulli Horlacher

unread,
Nov 18, 2021, 7:00:48 AM11/18/21
to
Peter Heitzer <peter....@rz.uni-regensburg.de> wrote:

> >P:\W10>pyinstaller.exe --onefile fextasy.py
> >140 INFO: PyInstaller: 4.7
> >140 INFO: Python: 3.10.0
> >171 INFO: Platform: Windows-10-10.0.19041-SP0
> >171 INFO: wrote P:\W10\fextasy.spec
> >171 INFO: UPX is not available.
> Vielleicht liegt es daran. Wie soll pyinstaller eine Exe erstellen, wenn
> der Packer nicht vorhanden ist.

Was ist das? Wo bekomme ich das her?


> In meiner Windows 10 VM hat allerdings ein einfaches Skript mit etwas
> Tk GUI funktioniert.
> Probier mal ein triviales Skript mit print('Hello') aus.

Ohne Tk funktionierts. Ich kann es dann allerdings nur genau einmal starten:


P:\>type argv.py
#!/usr/bin/python3

import sys

for a in sys.argv: print("["+a+"]")


P:\W10\dist>dir

Volume in drive P is Shared Folders
Volume Serial Number is 0000-0034

Directory of P:\W10\dist

18 Nov 2021 11:38 <DIR> .
18 Nov 2021 11:38 <DIR> ..
09 Oct 2017 13:30 6.775.867 fexit.exe
18 Nov 2021 10:36 251.392 fextasy.exe
18 Nov 2021 11:27 311.296 tcpbm.exe
18 Nov 2021 11:38 6.929.235 argv.exe
4 File(s) 14.268.132 bytes
2 Dir(s) 332.320.088.064 bytes free

P:\W10\dist>argv a b
[dist\argv]
[a]
[b]

P:\W10\dist>argv a b
The process cannot access the file because it is being used by another process.

P:\W10\dist>argv 1 2 zzz
The process cannot access the file because it is being used by another process.

Peter Heitzer

unread,
Nov 18, 2021, 7:32:49 AM11/18/21
to
Ulli Horlacher <fram...@rus.uni-stuttgart.de> wrote:
>Peter Heitzer <peter....@rz.uni-regensburg.de> wrote:

>> >P:\W10>pyinstaller.exe --onefile fextasy.py
>> >140 INFO: PyInstaller: 4.7
>> >140 INFO: Python: 3.10.0
>> >171 INFO: Platform: Windows-10-10.0.19041-SP0
>> >171 INFO: wrote P:\W10\fextasy.spec
>> >171 INFO: UPX is not available.
>> Vielleicht liegt es daran. Wie soll pyinstaller eine Exe erstellen, wenn
>> der Packer nicht vorhanden ist.

>Was ist das? Wo bekomme ich das her?
Das sollte IMO Bestandteil PyInstaller sein.
Strange. Was hast du für ein seltsames Windows?

Ulli Horlacher

unread,
Nov 18, 2021, 7:53:02 AM11/18/21
to
Peter Heitzer <peter....@rz.uni-regensburg.de> wrote:

> >> >171 INFO: UPX is not available.
> >> Vielleicht liegt es daran. Wie soll pyinstaller eine Exe erstellen, wenn
> >> der Packer nicht vorhanden ist.
>
> >Was ist das? Wo bekomme ich das her?
> Das sollte IMO Bestandteil PyInstaller sein.

Ist es wohl nicht.
Was muss ich noch installieren?


> >P:\W10\dist>argv 1 2 zzz
> >The process cannot access the file because it is being used by another process.
>
> Strange. Was hast du für ein seltsames Windows?

Windows 10

Peter Heitzer

unread,
Nov 18, 2021, 8:41:03 AM11/18/21
to
Ulli Horlacher <fram...@rus.uni-stuttgart.de> wrote:
>Peter Heitzer <peter....@rz.uni-regensburg.de> wrote:

>> >> >171 INFO: UPX is not available.
>> >> Vielleicht liegt es daran. Wie soll pyinstaller eine Exe erstellen, wenn
>> >> der Packer nicht vorhanden ist.
>>
>> >Was ist das? Wo bekomme ich das her?
>> Das sollte IMO Bestandteil PyInstaller sein.

>Ist es wohl nicht.
>Was muss ich noch installieren?
In meiner Windows 10 VM habe ich soeben python-3.9.6.exe aufgerufen und
als User in mein Benutzerprofile unter python39 installiert.
Danach einen neues cmd Fenster geöffnet, damit python im Pfad ist.
Dann pip install pyinstaller aufgerufen, ohne Probleme.
Mit pyinstaller --onefile tk3.py habe ich ein simples Programm erstellt.
Alles ohne Probleme.
Entweder ist bei deinem Windows etwas oberfaul oder die Python 3.10 hat
ein Problem. Mehr fällt mir dazu nicht ein.

Peter Heitzer

unread,
Nov 18, 2021, 9:04:24 AM11/18/21
to
Gerade noch ausprobiert:
Auch mit Python 3.10 funktioniert es bei mir.

Ulli Horlacher

unread,
Nov 18, 2021, 11:08:32 AM11/18/21
to
Peter Heitzer <peter....@rz.uni-regensburg.de> wrote:

> >P:\W10>pyinstaller.exe --onefile fextasy.py
> >140 INFO: PyInstaller: 4.7
> >140 INFO: Python: 3.10.0
> >171 INFO: Platform: Windows-10-10.0.19041-SP0
> >171 INFO: wrote P:\W10\fextasy.spec
> >171 INFO: UPX is not available.
> Vielleicht liegt es daran. Wie soll pyinstaller eine Exe erstellen, wenn
> der Packer nicht vorhanden ist.

UPX ist optional sagt:

https://pyinstaller.readthedocs.io/en/stable/usage.html#using-upx

PyInstaller looks for UPX on the execution path or the path specified with
the --upx-dir option. If UPX exists, PyInstaller applies it to the final
executable, unless the --noupx option was given. UPX has been used with
PyInstaller output often, usually with no problems.

ABER: inzwischen funktioniert pyinstaller wieder ohne Fehlermeldung:


P:\W10>pyinstaller.exe --onefile --icon fex.ico fextasy.py
124 INFO: PyInstaller: 4.7
124 INFO: Python: 3.10.0
140 INFO: Platform: Windows-10-10.0.19041-SP0
140 INFO: wrote P:\W10\fextasy.spec
140 INFO: UPX is not available.
156 INFO: Extending PYTHONPATH with paths
['P:\\W10']
484 INFO: checking Analysis
625 INFO: checking PYZ
656 INFO: checking PKG
750 INFO: Bootloader C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
750 INFO: checking EXE
781 INFO: Rebuilding EXE-00.toc because fextasy.exe missing
781 INFO: Building EXE from EXE-00.toc
781 INFO: Copying bootloader EXE to P:\W10\dist\fextasy.exe
890 INFO: Copying icon to EXE
890 INFO: Copying icons from ['fex.ico']
890 INFO: Writing RT_GROUP_ICON 0 resource with 20 bytes
890 INFO: Writing RT_ICON 1 resource with 18488 bytes
921 INFO: Copying 0 resources to EXE
921 INFO: Emedding manifest in EXE
921 INFO: Updating manifest in P:\W10\dist\fextasy.exe
1046 INFO: Updating resource type 24 name 1 language 0
1077 INFO: Appending PKG archive to EXE
3484 INFO: Building EXE from EXE-00.toc completed successfully.


Typisch Windoof eben: mal tuts, dann wieder nicht, voellig erratisch :-(


Allerdings wird das Programm-Icon nur im Windows File Manager angezeigt
und nicht auf dem Desktop:

https://fex.flupp.org/fop/3ElTOtEh/X-20211118164905.png

Was geht da schon wieder schief?

Peter Heitzer

unread,
Nov 18, 2021, 11:45:59 AM11/18/21
to
Icons müssen in unterschiedlichen Grössen als Ressource ins Binary. Vielleicht
fehlt eine dieser Grössen in der 'fex.ico'.
Mir persönlich ist es völlig egal, wie das Icon ausschaut. Ich arbeite auch
unter Windows wenn möglich auf der Commandebene. Den Explorer verwende ich
selten, da ich ihn für absolut untauglich halte. Nicht einmal den
richtigen Pfad zeigt er an. 'This PC' anstelle von /users/xxx ist
IMO Unsinn.

Ulli Horlacher

unread,
Nov 18, 2021, 1:12:55 PM11/18/21
to
Peter Heitzer <peter....@rz.uni-regensburg.de> wrote:

> >Allerdings wird das Programm-Icon nur im Windows File Manager angezeigt
> >und nicht auf dem Desktop:
>
> >https://fex.flupp.org/fop/3ElTOtEh/X-20211118164905.png
>
> Icons müssen in unterschiedlichen Grössen als Ressource ins Binary. Vielleicht
> fehlt eine dieser Grössen in der 'fex.ico'.

Welche Groesse muss das sein? In der Doku von pyinstaller habe ich nichts
dazu gefunden.


> Mir persönlich ist es völlig egal, wie das Icon ausschaut. Ich arbeite auch
> unter Windows wenn möglich auf der Commandebene. Den Explorer verwende ich
> selten, da ich ihn für absolut untauglich halte.

Ich arbeite normalerweise gar nicht unter Windows, da ich das fuer absolut
untauglich halte - in jeder Beziehung!

Aber meine User sind halt auf der Dunklen Seite der Macht :-}
Und die wollen unbedingt passende icons auf dem Desktop haben, sonst
finden die nix.

Peter Heitzer

unread,
Nov 19, 2021, 2:41:42 AM11/19/21
to
Ulli Horlacher <fram...@rus.uni-stuttgart.de> wrote:
>Peter Heitzer <peter....@rz.uni-regensburg.de> wrote:

>> >Allerdings wird das Programm-Icon nur im Windows File Manager angezeigt
>> >und nicht auf dem Desktop:
>>
>> >https://fex.flupp.org/fop/3ElTOtEh/X-20211118164905.png
>>
>> Icons müssen in unterschiedlichen Grössen als Ressource ins Binary. Vielleicht
>> fehlt eine dieser Grössen in der 'fex.ico'.

>Welche Groesse muss das sein? In der Doku von pyinstaller habe ich nichts
>dazu gefunden.
Keine Ahnung, ist für mich kein Thema.


>> Mir persönlich ist es völlig egal, wie das Icon ausschaut. Ich arbeite auch
>> unter Windows wenn möglich auf der Commandebene. Den Explorer verwende ich
>> selten, da ich ihn für absolut untauglich halte.

>Ich arbeite normalerweise gar nicht unter Windows, da ich das fuer absolut
>untauglich halte - in jeder Beziehung!
It depends. Python und Perl funktionieren brauchbar und Office verwende ich
nicht. Für die administrativen Aufgaben habe ich passende Utilities; meist
selber geschrieben.

>Aber meine User sind halt auf der Dunklen Seite der Macht :-}
>Und die wollen unbedingt passende icons auf dem Desktop haben, sonst
>finden die nix.
Vmtl. können die auch keine Worddatei kopieren, wenn auf dem Rechner kein
MS-Office installiert ist. Solche Benutzer halte ich ebenfalls für
absolut untauglich :-(

Hartmut Goebel

unread,
Feb 12, 2022, 9:17:28 AM2/12/22
to
Am 18.11.21 um 19:12 schrieb Ulli Horlacher:
> Welche Groesse muss das sein? In der Doku von pyinstaller habe ich nichts
> dazu gefunden.

Das ist ja auch keine Frage von PyInstaller, sondern von Windows :-)

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software
Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: https://www.goe-con.de/blog/alternative-android-betriebssystem
Kolumne:
https://www.goe-con.de/hartmut-goebel/cissp-gefluester/2010-07-passwoerter-lieben-lernen

0 new messages