indygreg / PyOxidizer

A modern Python application packaging and distribution tool
Mozilla Public License 2.0
5.32k stars 227 forks source link

Pyoxidizer multiprocessing problem. #748

Open jonike opened 1 month ago

jonike commented 1 month ago

Hello, guys. When i compile program to pyoxidizer app in windows and run it. it's give me a error:

Traceback (most recent call last): File "multiprocessing.spawn", line 107, in spawn_main File "multiprocessing.reduction", line 79, in duplicate TypeError: DuplicateHandle() argument 2 must be int, not dict

code :

    import multiprocessing

    def run_webview():
       ...

    p = multiprocessing.Process(target=run_webview,args=())
    p.start()

What happen?

jonike commented 1 month ago

IN Lib/multiprocessing/reduction.py:

def duplicate(handle, target_process=None, inheritable=False, *, source_process=None):
        '''Duplicate a handle.  (target_process is a handle not a pid!)'''
        current_process = _winapi.GetCurrentProcess()
        if source_process is None:
            source_process = current_process
        if target_process is None:
            target_process = current_process

        print("source_process:", source_process)
        print("handle:", handle)
        print("target_process:",target_process)

        return _winapi.DuplicateHandle(
            source_process, handle, target_process,
            0, inheritable, _winapi.DUPLICATE_SAME_ACCESS)

========================== Result In python.exe source_process: 344 handle: 348 target_process: 18446744073709551615

Result in pyoxidizer compiled.exe source_process: 18446744073709551615 handle: {'parent_pid': 21052, 'pipe_handle': 332} target_process: 18446744073709551615

Please, anyone can help me?