Apr-29-2020, 06:48 PM
Hi everyone,
I am trying to make the executable of my python script with Pyinstaller. I am using:
PyInstaller: 3.6
Python: 3.7.7
Windows 10 64Bits
When I run my script from Windows command terminal, it works fine. When I run the exe produced by Pyinstaller I have this error shown on terminal:
My code start with the freeze as recommended:
So I made the exe with the option --dir in order to make the executable with dolls, and I get exact same issue.
I run some specific Pyinstaller commands, it is displaying something, but I don't understand what it means:
as I saw issues with multiprocessing and futures.. But it didn't fix anything
I tried this one:
still same issue.
So I check this line 691 in this connection.py file, but I don't understand the issue:
I am not good enough in Python to fix this issue. I can just make the conclusion that Pyinstaller is breaking something as the script is running perfectly fine from the terminal. Also I see that system is saying it cannot find a file. So a file or module is missing, that is why I tried some stuff in .spec file.
Does anyone know the source of my problem please?
I am trying to make the executable of my python script with Pyinstaller. I am using:
PyInstaller: 3.6
Python: 3.7.7
Windows 10 64Bits
When I run my script from Windows command terminal, it works fine. When I run the exe produced by Pyinstaller I have this error shown on terminal:
Output:Process SpawnProcess-4:
Traceback (most recent call last):
File "multiprocessing\process.py", line 297, in _bootstrap
File "multiprocessing\process.py", line 99, in run
File "concurrent\futures\process.py", line 233, in _process_worker
File "multiprocessing\queues.py", line 113, in get
File "multiprocessing\managers.py", line 943, in RebuildProxy
File "multiprocessing\managers.py", line 793, in __init__
File "multiprocessing\managers.py", line 847, in _incref
File "multiprocessing\connection.py", line 490, in Client
File "multiprocessing\connection.py", line 691, in PipeClient
FileNotFoundError: [WinError 2] The system cannot find the file specified
A process in the process pool was terminated abruptly while the future was running or pending. --> Error multiprocessor]
This is my piece of code which create this error:1 2 3 4 5 6 7 8 9 10 |
with concurrent.futures.ProcessPoolExecutor() as executor: try : #multiprocesses = executor.map(mymodules.run_smartphone, list_arguments_smartphones) multiprocesses = executor. map (mymodules.run_smartphone, list_smartphones_connected, [lock] * len (list_smartphones_connected)) for function_return_value in multiprocesses: print (function_return_value) except Exception as ex: print ( f "{ex} --> Error multiprocesses" ) |
1 2 3 |
if __name__ = = '__main__' : import multiprocessing multiprocessing.freeze_support() |
I run some specific Pyinstaller commands, it is displaying something, but I don't understand what it means:
Output:E:\>pyi-bindepend Myprogram.exe
Myprogram.exe {'KERNEL32.dll', '*_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.0.0_none', 'WS2_32.dll', 'ADVAPI32.dll'}
E:\>pyi-archive_viewer Myprogram.exe
pos, length, uncompressed, iscompressed, type, name
[(0, 270, 354, 1, 'm', 'struct'),
(270, 1124, 1832, 1, 'm', 'pyimod01_os_path'),
(1394, 4376, 9337, 1, 'm', 'pyimod02_archive'),
(5770, 7417, 18651, 1, 'm', 'pyimod03_importers'),
(13187, 1868, 4175, 1, 's', 'pyiboot01_bootstrap'),
(15055, 266, 321, 1, 's', 'pyi_rth_certifi'),
(15321, 1080, 1775, 1, 's', 'pyi_rth_multiprocessing'),
(16401, 8845, 18589, 1, 's', 'Myprogram'),
(25246, 3052666, 3052666, 0, 'z', 'PYZ-00.pyz')]
?
so I added in the .spec file some hiddenimport:hiddenimports=["socks","multiprocessing","concurrent"],
as I saw issues with multiprocessing and futures.. But it didn't fix anything
I tried this one:
hiddenimports=["socks","multiprocessing","concurrent.futures"],
still same issue.
So I check this line 691 in this connection.py file, but I don't understand the issue:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
def PipeClient(address): ''' Return a connection object connected to the pipe given by `address` ''' t = _init_timeout() while 1 : try : _winapi.WaitNamedPipe(address, 1000 )< = = - - - - - - - - - - - - - - - - - - - - - - - - [line 691 ] h = _winapi.CreateFile( address, _winapi.GENERIC_READ | _winapi.GENERIC_WRITE, 0 , _winapi.NULL, _winapi.OPEN_EXISTING, _winapi.FILE_FLAG_OVERLAPPED, _winapi.NULL ) except OSError as e: if e.winerror not in (_winapi.ERROR_SEM_TIMEOUT, _winapi.ERROR_PIPE_BUSY) or _check_timeout(t): raise else : break else : raise _winapi.SetNamedPipeHandleState( h, _winapi.PIPE_READMODE_MESSAGE, None , None ) return PipeConnection(h) |
Does anyone know the source of my problem please?