f%ddlZddlZddlZddlZddlmZmZddlmZddlm Z ddlm Z gdZ ej dkrd Z d Zn@eed d Z ejo+ejd Zd Zd Zer*eejejdneejdZdZdZddZdZdZdZgZdZ dZ!dZ"dZ#dS)N)get_start_methodset_start_method)process) reduction)util)_mainfreeze_supportset_executableget_executableget_preparation_dataget_command_lineimport_main_pathwin32Ffrozenzpythonservice.exec||adStjdkrtj|adStj|adS)Nr) _python_exesysplatformosfsdecodefsencode)exes z$get_command_line..Ys999D4999rzz#get_command_line..\s&BBT'D.BBBBBBrz-c)getattrr executableitemsjoinr_args_from_interpreter_flagsr )r+progoptsrs rrrSssHe$$E!9:99DJJLL999: ;N  BBTZZ\\BBBBBB022ut|tT+CDDDrctjdkrjddl}ddl}|%||j|jzd|}nd}tj||}| |tj }|}n(ddl m } || j_|}tj|}t#||} tj| dS)z7 Run code specified by data received over pipe rrNF)source_processr)resource_tracker)rrmsvcrt_winapi OpenProcess SYNCHRONIZEPROCESS_DUP_HANDLEr duplicateopen_osfhandlerO_RDONLYrA_resource_tracker_fddupr r*) pipe_handle parent_pid tracker_fdrBrCr@ new_handlefdparent_sentinelrAexitcodes rr)r)bs  |w   !$00#g&@@z##NN"N(8FHHH  " ":r{ ; ;(&&&&&&1;*. &--R))HHXrctj|dd5}dtj_ t j|}t|t j|}tj`n#tj`wxYw dddn #1swxYwY| |S)NrbT)closefd) rfdopenrcurrent_process _inheritingrpickleloadprepare _bootstrap)rRrS from_parentpreparation_dataselfs rr r ~s 2tT * * *6k04!!- 6(/44[AA  $ % % %#((55D'))55'))5 5 5 5 55666666666666666 ??? + ++s)B8A B?B8B((B88B<?B<chttjddrtddS)NrZFa 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 )r8rrY RuntimeErrorrrr_check_not_importing_mainrds@w&((-??       rc tttjt jj}tj!tj|d<tj } | d}tj ||<n#t$rYnwxYw|||tjtj t#jt'tjd}t+|jdd}|||d<ntjd kst0st2st+|d d}|wt"j |s6tj *t"j tj |}t"j ||d <|S) zM Return info about parent needed by child to unpickle process object ) log_to_stderrauthkeyN log_levelrJ)r-sys_pathsys_argvorig_dirdir start_method__main__r-init_main_from_namer__file__init_main_from_path)rddictr_log_to_stderrrrYrg_loggergetEffectiveLevelrpathcopyindex ORIGINAL_DIR ValueErrorupdater"rgetcwdrmodulesr8__spec__rWINEXE WINSERVICEisabsr;normpath)r-drii main_module main_mod_name main_paths rr r s )'))1   A  |7799+ X]]__H+ NN2  *       HH % IKK%''     +j)KK0&$??M #0     KT::  GMM),, J,8GLL)=yII ')w'7'7 'B'BA# $ Hs B11 B>=B>cd|vr|dtj_d|vr|dtj_d|vr|drt jd|vr,t j|dd|vr|dt_ d|vr|dt_ d|vrtj |dd|vr|dt_ d |vrt|d d d |vrt|d dSd |vrt!|d dSdS)zE Try to get current process ready to unpickle process object r-rgrfrhrirjrlrkrmT)forcerorqN)rrYr-rgrrf get_loggersetLevelrrvr"rchdirryr_fixup_main_from_name_fixup_main_from_path)datas rr]r]sj~~)-f!!&D,0O!!)$4#8 d ""4 #4555T #T # }} eT#J/n-T::::$$d#89::::: $ & &d#89::::: ' &rctjd}|dks|drdSt|jdd|krdSt |tjd}tj |dd}|j ||xtjd<tjd<dS)Nrnz .__main__r- __mp_main__T)run_name alter_sys) rr}endswithr8r~old_main_modulesappendtypes ModuleTyperunpy run_module__dict__r{)mod_name current_mainr main_contents rrrs ;z*L:!2!2;!?!?|$fd33x?? L)))"=11K#H-:.2444L ---;FFCK ck-888rctjd}tjtj|d}|dkrdSt |dd|krdSt|tj d}tj |d}|j ||xtjd<tjd<dS)Nrnripythonrpr)r)rr}rrvsplitextbasenamer8rrrrrrun_pathrr{)rr main_namerrs rrrs;z*L   !1!1)!)+8:::L ---;FFCK ck-888rc$t|dS)z< Set sys.modules['__main__'] to module at main_path N)r)rs rrr/s)$$$$$r)NN)$rrrrrJrrrcontextrr__all__rrrr8r9lowerrr r rvr; exec_prefixr#r rr)r rdr rr]rrrrrrrs  00000000 K K K<7 FJJ WS(E * *FXCN$8$8$:$:$C$CDW$X$XJ'''#N27<<>>????N3>"""     E E E8 , , ,   ,, , , d";";";LGGG2GGG8%%%%%r