Ich nutzte ich SciTE einen einfaches Debugger Skript, siehe: http://www.jensdiemer.de/de/Tipps-und-T ... hon/SciTE/
Das verträgt sich aber nicht mit multiprocessing. Der debugger startet das eigentliche Skript so:
Code: Alles auswählen
def print_exc_plus():
...
if __name__ == '__main__':
filepath, filename = os.path.split(sys.argv[1])
print "Start %r (%r):" % (filename, filepath)
os.chdir(filepath)
current_dir = os.getcwd()
sys.path.insert(0, current_dir)
locals_globals = {
'__builtins__': __builtins__,
'__name__': '__main__',
'__file__': filename, # skript should see this "own" filename
}
try:
execfile(filename, locals_globals, locals_globals)
except SystemExit:
pass
except:
print_exc_plus()
Hab das Beispiel von https://docs.python.org/2/library/multi ... -processes genommen, also:
Code: Alles auswählen
from multiprocessing import Process, Queue
def f(q):
q.put([42, None, 'hello'])
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=(q,))
p.start()
print q.get() # prints "[42, None, 'hello']"
p.join()
Code: Alles auswählen
Traceback (most recent call last):
File "D:\sync\jens\SciTE_python_debugger.py", line 121, in <module>
execfile(filename, locals_globals, locals_globals)
File "multiprocessing_pipes.py", line 13, in <module>
p.start()
File "C:\Python27\lib\multiprocessing\process.py", line 130, in start
self._popen = Popen(self)
File "C:\Python27\lib\multiprocessing\forking.py", line 277, in __init__
dump(process_obj, to_child, HIGHEST_PROTOCOL)
File "C:\Python27\lib\multiprocessing\forking.py", line 199, in dump
ForkingPickler(file, protocol).dump(obj)
File "C:\Python27\lib\pickle.py", line 224, in dump
self.save(obj)
File "C:\Python27\lib\pickle.py", line 331, in save
self.save_reduce(obj=obj, *rv)
File "C:\Python27\lib\pickle.py", line 419, in save_reduce
save(state)
File "C:\Python27\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python27\lib\pickle.py", line 649, in save_dict
self._batch_setitems(obj.iteritems())
File "C:\Python27\lib\pickle.py", line 681, in _batch_setitems
save(v)
File "C:\Python27\lib\pickle.py", line 286, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Python27\lib\pickle.py", line 748, in save_global
(obj, module, name))
PicklingError: Can't pickle <function f at 0x01E22130>: it's not found as __main__.f
Ideen?