g%ddlZddlZddlZddlZddlmZmZddlmZddlm Z ddlm Z gdZ ejdk7rd Z d ZnAeed d Z ej xr)ej j#j%d Zd Zd Zer-eej*j-ej.dneej dZdZdZddZdZdZdZgZdZ dZ!dZ"dZ#y)N)get_start_methodset_start_method)process) reduction)util)_mainfreeze_supportset_executableget_executableget_preparation_dataget_command_lineimport_main_pathwin32Ffrozenzpythonservice.exec||aytjdk(rtj|aytj |ay)Nr) _python_exesysplatformosfsdecodefsencode)exes z#get_command_line..\sB\T'D.\sz-c)getattrr executableitemsjoinr_args_from_interpreter_flagsr )r+r3progoptsrs rrrSssHe$!9:,0JJL9LD4L9: ;N  BTZZ\BBB002ut|tT+CDDD :s Bctjdk(rqddl}ddl}|+|j |j |j zd|}nd}tj||}|j|tj}|}n.ddl m } || j_|}tj |}t#||} tj$| y)z7 Run code specified by data received over pipe rrNF)source_processr)resource_tracker)rrmsvcrt_winapi OpenProcess SYNCHRONIZEPROCESS_DUP_HANDLEr duplicateopen_osfhandlerO_RDONLYr>_resource_tracker_fddupr r*) pipe_handle parent_pid tracker_fdr?r@r= new_handlefdparent_sentinelr>exitcodes rr)r)bs  ||w  !$00##g&@&@@z#N"N((8FH  " ":r{{ ;(&1;**. &&-R)HHHXrctj|dd5}dtj_ t j j|}t|t j j|}tj` dddj|S#tj`wxYw#1swY3xYw)NrbT)closefd) rfdopenrcurrent_process _inheritingrpickleloadprepare _bootstrap)rOrP from_parentpreparation_dataselfs rr r ~s 2tT *k04!- 6(//44[A  $ %##((5D'')5 + ??? ++'')5 + *s#CA B+=C+CCC cXttjddr tdy)NrWFa An attempt has been made to start a new process before the current process has finished its bootstrapping phase. This probably means that you are not using fork to start your child processes and you have forgotten to use the proper idiom in the main module: if __name__ == '__main__': freeze_support() ... The "freeze_support()" line can be omitted if the program is not going to be frozen to produce an executable. To fix this issue, refer to the "Safe importing of main module" section in https://docs.python.org/3/library/multiprocessing.html )r5rrV RuntimeErrorrrr_check_not_importing_mainras/w&&(-?   @rc tttjt j j }tj!tjj|d<tjj} |jd}tj||<|j||tj tjt#j$t'tj(d}t+|j,dd}|||d<|Stj.d k7s t0st2st+|d d}|t"jj5|s>tj.t"jj7tj|}t"jj9||d <|S#t$rY;wxYw) zM Return info about parent needed by child to unpickle process object ) log_to_stderrauthkeyN log_levelrG)r-sys_pathsys_argvorig_dirdir start_method__main__r-init_main_from_namer__file__init_main_from_path)radictr_log_to_stderrrrVrd_loggergetEffectiveLevelrpathcopyindex ORIGINAL_DIR ValueErrorupdater"rgetcwdrmodulesr5__spec__rWINEXE WINSERVICEisabsr8normpath)r-drfi main_module main_mod_name main_paths rr r s ))'')11 A  ||779+ XX]]_H+ NN2 ** HH %% IIK%'   ++j)KK00&$?M #0   H   KT:  GGMM),,,8GGLL)=)=yI ')ww'7'7 'BA# $ H9    sG%% G21G2c*d|vr|dtj_d|vr|dtj_d|vr|drt j d|vr&t j j|dd|vr|dt_ d|vr|dt_ d|vrtj|dd|vr|dt_ d |vrt|d d d |vrt|d yd |vrt!|d yy)zE Try to get current process ready to unpickle process object r-rdrcrerfrgrirhrjT)forcerlrnN)rrVr-rdrrc get_loggersetLevelrrsr"rchdirrvr_fixup_main_from_name_fixup_main_from_path)datas rrZrZs~)-f!&D,0O!)$4#8 d ""4 #45T #T # } eT#J/n-T:$d#89: $ &d#89: 'rctjd}|dk(s|jdryt|jdd|k(ryt j |tjd}tj|dd}|jj||xtjd<tjd<y)Nrkz .__main__r- __mp_main__T)run_name alter_sys) rrzendswithr5r{old_main_modulesappendtypes ModuleTyperunpy run_module__dict__rx)mod_name current_mainr main_contents rrrs ;;z*L:!2!2;!?|$$fd3x? L)""=1K##H-:.24L -;FFCKK ckk-8rctjd}tjj tjj |d}|dk(ryt |dd|k(rytj|tjd}tj|d}|jj||xtjd<tjd<y)Nrkripythonrmr)r)rrzrrssplitextbasenamer5rrrrrrun_pathrrx)rr main_namerrs rrrs;;z*L   !1!1)!<=a@II|Z.); L)""=1K>>)+8:L -;FFCKK ckk-8rct|y)z< Set sys.modules['__main__'] to module at main_path N)r)rs rrr/s )$r)NN)$rrrrrGrrrcontextrr__all__rr|r}r5r6lowerrr r rsr8 exec_prefixr#r rr)r rar rrZrrrrrrrs 0 K<<7 FJ S(E *FXCNN$8$8$:$C$CDW$XJ'277<<>?3>>"   E8 , ,, d";LG2G8%r