0
我有一个脚本在Python 2个工作,我试图使它在Python工作3多处理池3
一两件事,我偶然发现,并没有关于如何解决思路是事实在类Applyresult得到()()方法似乎是现在抛出:
在Pycharm回溯是:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py", line 1733, in <module>
debugger.run(setup['file'], None, None)
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py", line 1226, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\_pydev_execfile.py", line 38, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc) #execute the script
File "D:/SRC/CDR/trunk/RegressionTests/ExeTests/pyQCDReg_Launcher.py", line 125, in <module>
result_list = ar.get()
File "C:\Python33\lib\multiprocessing\pool.py", line 564, in get
raise self._value
TypeError: can't use a string pattern on a bytes-like object
线违规是pool.py:
def get(self, timeout=None):
self.wait(timeout)
if not self.ready():
raise TimeoutError
if self._success:
return self._value
else:
raise self._value // This is the line raising the exception
它是由下面一行在我的脚本调用:
pool = Pool(processes=8)
ar = pool.map_async(run_regtest, command_list)
pool.close()
start_time = time.time()
while True:
elapsed = time.time() - start_time
if (ar.ready()): break
remaining = ar._number_left
print("Elapsed,", elapsed, ", Waiting for", remaining, "tasks to complete...")
time.sleep(30)
pool.join()
ar.wait()
print("finished")
result_list = ar.get() // This is the offending line causing the exception
这个脚本是在Python 2个工作,我不明白为什么它不会出现在Python 3合作有没有人有一个想法,为什么?
是的,实际的错误是在'run_regtest'中。看起来像Python 3中对unicode处理的更改已经破坏了该函数。 – dano 2014-11-06 19:43:47
你是对的,我使用了一个reg exp,它是以前的字节进行解码的非regresssion测试输出。 – BlueTrin 2014-11-07 09:33:06