I further tried to get around this issue and took the effort to replace in 
my app the import statement

import <myOtherModule>
with 
from<myOtherModule> import x,y,z, ....
Again this works fine in VSCode environment. After 
pyinstaller -c --onefile <myApp>
I get an .exe, which executes and terminates with the following error msg
...
ImportError: cannot import name 'xyz' from <myOtherModule> 
(C:\Users\myname\AppData\Local\Temp\_MEI260402\<myOtherModule>\__init__.pyc)
[PYI-24848:ERROR] Failed to execute script <myApp> due to unhandled 
exception

It seems that pyinstaller somehow finds myOtherModule but does not properly 
import
it. The temporary directory is not available after program termination so I 
cannot access the __init__.pyc file

The directory name _MEIxxxx tells me that this is from pyinstaller.

Can anyone shed some light on this please ?




Gernot Schreider schrieb am Mittwoch, 18. Dezember 2024 um 14:25:00 UTC+1:

> Pyinstaller vers. 6.11.1
> from a python app, which runs from within VSCode I try to generate .exe 
> with
>
> pyinstaller -p 
> C:\users\<myname>\AppData\Roaming\Python\Python311\site-packages 
>                     -c
>                   --onefile    .<mypythonapp.py
> It creates the .exe but when I run it the exe throws this error 
> AttributeError: module <myOtherModule> has no attribute <xyz>
>
> <xyz> being a function, which is defined in <myOtherModule>
>
> I am importing another Python script in my app via 
> import <myOtherModule>
>
> I suspected some problems with paths and tried various but did not succeed.
> It is puzzling as it did work a few monts ago, I have no clue which 
> changes cause now this error. I did update pyinstaller but that did not 
> help though.
>
> Any advice how to resolve is very welcome
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/pyinstaller/c08c6fea-dcd5-4d9e-a057-236b9754b0e0n%40googlegroups.com.

Reply via email to