进程子类可以在Linux上运行,但不能在Windows上运行

我试图让Windowspython工作,但是当我做import gasp; gasp.begin_graphics() import gasp; gasp.begin_graphics()我得到以下回溯:

  File "C:\Python26\lib\site-packages\gasp\backend.py", line 142, in create_screen screen.updater.start() File "C:\Python26\lib\multiprocessing\process.py", line 104, in start self._popen = Popen(self) File "C:\Python26\lib\multiprocessing\forking.py", line 239, in __init__ 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 self.save(obj) 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 286, in save f(self, obj) # Call unbound method with explicit self File "C:\Python26\lib\pickle.py", line 725, in save_inst save(stuff) 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 331, in save self.save_reduce(obj=obj, *rv) File "C:\Python26\lib\pickle.py", line 396, in save_reduce save(cls) 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 748, in save_global (obj, module, name)) PicklingError: Can't pickle <class 'multiprocessing.process._MainProcess'>: it's not found as multiprocessing.process._MainProcess 

任何想法,为什么我得到这个错误在Windows XP上,而不是在Ubuntu Linux 9.04?

它看起来像screen.updaterUpdater(multiprocessing.Process) ( def )的一个实例,如果有帮助。 有问题的文件在http://bazaar.launchpad.net/~gasp-dev/gasp-core/main/annotate/head%3A/gasp/backend.py

Solutions Collecting From Web of "进程子类可以在Linux上运行,但不能在Windows上运行"

您的Updater类有一个成员screen ,它本身有一个成员process ,它接收multiprocessing.current_process()的值。

当你调用updater.start() ,它会尝试更新更新器。 这只发生在Windows上,因为Linux使用fork()而不是酸洗。 但是,当前进程对象不能被清理,引发异常。

要解决这个问题,你可以删除process成员。