@BlackJack:
ich habe den Code jetzt mal nicht aus der IDE aus gestartet, sondern direkt. Das Problem mit dem Pickler tritt dann nicht auf.
Jetzt erhalte ich diese Fehlermeldung, die ja sehr aussagekräftig ist und den Hinweis mit freeze_support() enthält:
Code: Alles auswählen
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
prepare(preparation_data)
File "C:\Python27\lib\multiprocessing\forking.py", line 495, in prepare
'__parents_main__', file, path_name, etc
File "C:\myProg\program_control.py", line 746, in <module>
lauf(data)
File "C:\myProg\program_control.py", line 232, in lauf
rn.cg(instanz_name, None, max_labels_to_create)
File "C:\myProg\Node.py", line 159, in cg
LABE_aller_perioden = self.solve_KW(arcs_to_forbid, max_labels_to_create)
File "C:\myProg\Node.py", line 121, in solve_KW
pool = multiprocessing.Pool()
File "C:\Python27\lib\multiprocessing\__init__.py", line 232, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild)
File "C:\Python27\lib\multiprocessing\pool.py", line 159, in __init__
self._repopulate_pool()
File "C:\Python27\lib\multiprocessing\pool.py", line 222, in _repopulate_pool
w.start()
File "C:\Python27\lib\multiprocessing\process.py", line 130, in start
self._popen = Popen(self)
File "C:\Python27\lib\multiprocessing\forking.py", line 258, in __init__
cmd = get_command_line() + [rhandle]
File "C:\Python27\lib\multiprocessing\forking.py", line 358, in get_command_li
ne
is not going to be frozen to produce a Windows executable.''')
RuntimeError:
Attempt to start a new process before the current process
has finished its bootstrapping phase.
This probably means that you are on Windows 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 a Windows executable.
Aber: ich habe keine __main__ in meinem Programm drin. Python rufe ich direkt über eine batch auf mit Übergabeparametern.
Muss if __name__ == '__main__' im Programm enthalten sein, um freeze_support zu nutzen?
Habe den freeze_support() Befehl mal direkt vor
Code: Alles auswählen
multiprocessing.freeze_support()
pool = multiprocessing.Pool()
gesetzt.
Das hat jetzt keine Abhilfe geschaffen, die Fehlermeldung taucht weiterhin auf.
Zuversichtlich stimmt mich jetzt aber: Wenn ich den Prozessverlauf im Taskmanager anschaue bleibts aber jetzt schon bei den maximal 7 Aufrufen und die Prozesse verschwinden nach der Ausführung, also keine Endlosschleife mehr.
Was könnte ich noch ändern?