Sviluppo con Python su Linux e non ho mai visto questo tipo di problema con Windows. Sto usando la libreria multiprocessing
per accelerare i calcoli, che funziona molto bene per me su Linux.Multiprocessing su interruzioni di Windows
In Windows, però, le cose non vanno nel modo migliore:
* [INFO] Parsing 1 file using 2 threads
Traceback (most recent call last):
File "main.py", line 170, in <module>
master = ParsingMaster(parser, list(input_file), output_list, threads=num_threads)
Traceback (most recent call last):
File "main.py", line 39, in __init__
File "<string>", line 1, in <module>
self.input_process.start()
File "C:\Python26\lib\multiprocessing\forking.py", line 342, in main
File "C:\Python26\lib\multiprocessing\process.py", line 104, in start
self._popen = Popen(self)
self = load(from_parent)
File "C:\Python26\lib\multiprocessing\forking.py", line 239, in __init__
File "C:\Python26\lib\pickle.py", line 1370, in load
dump(process_obj, to_child, HIGHEST_PROTOCOL)
File "C:\Python26\lib\multiprocessing\forking.py", line 162, in dump
ForkingPickler(file, protocol).dump(obj)
File "C:\Python26\lib\pickle.py", line 224, in dump
return Unpickler(file).load()
self.save(obj)
File "C:\Python26\lib\pickle.py", line 858, in load
File "C:\Python26\lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\Python26\lib\pickle.py", line 419, in save_reduce
dispatch[key](self)
File "C:\Python26\lib\pickle.py", line 880, in load_eof
save(state)
File "C:\Python26\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
r aise EOFError
File "C:\Python26\lib\pickle.py", line 649, in save_dict
EOFError
self._batch_setitems(obj.iteritems())
File "C:\Python26\lib\pickle.py", line 681, in _batch_setitems
save(v)
File "C:\Python26\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python26\lib\multiprocessing\forking.py", line 40, in dispatcher
self.save_reduce(obj=obj, *rv)
File "C:\Python26\lib\pickle.py", line 401, in save_reduce
save(args)
File "C:\Python26\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python26\lib\pickle.py", line 548, in save_tuple
save(element)
File "C:\Python26\lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\Python26\lib\pickle.py", line 419, in save_reduce
save(state)
File "C:\Python26\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python26\lib\pickle.py", line 649, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\Python26\lib\pickle.py", line 681, in _batch_setitems
save(v)
File "C:\Python26\lib\pickle.py", line 306, in save
rv = reduce(self.proto)
File "C:\Python26\lib\multiprocessing\managers.py", line 458, in __reduce__
return type(self).from_address, \
AttributeError: type object 'SyncManager' has no attribute 'from_address'
sto testando su entrambi Python 2.6 e 2.7 su Windows 7 e ottengono questo stesso errore più e più volte. Qualcuno sa cosa significa?
Hai letto [la documentazione specifica della piattaforma] (http://docs.python.org/library/multiprocessing.html#windows), in particolare la prima restrizione? –
Grazie, l'ho appena fatto. Sto solo usando le liste come argomenti per l'intera classe, quindi non ci dovrebbero essere errori di decapaggio. Neanche io sto sottoclasse il processo. – Blender