rsennrich/Bleualign

Bug report: TypeError: cannot serialize '_io.TextIOWrapper' object

Closed this issue · 2 comments

(yzdnlp) C:\Users\PC\Desktop\test_align\Bleualign>python bleualign.py -s test_contract/src_zh.txt -t test_contract/tar_en.txt --srctotarget test_contract/src_zh_cn_en.txt -o test_contract/align_out.txt

I got the following error:

Traceback (most recent call last):
  File "bleualign.py", line 15, in <module>
    a.mainloop()
  File "C:\Users\PC\Desktop\test_align\Bleualign\bleualign\align.py", line 232, in mainloop
    p.start()
  File "F:\Anaconda3\envs\yzdnlp\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "F:\Anaconda3\envs\yzdnlp\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "F:\Anaconda3\envs\yzdnlp\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "F:\Anaconda3\envs\yzdnlp\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
    reduction.dump(process_obj, to_child)
  File "F:\Anaconda3\envs\yzdnlp\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
TypeError: cannot serialize '_io.TextIOWrapper' object

(yzdnlp) C:\Users\PC\Desktop\test_align\Bleualign>Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "F:\Anaconda3\envs\yzdnlp\lib\multiprocessing\spawn.py", line 99, in spawn_main
    new_handle = reduction.steal_handle(parent_pid, pipe_handle)
  File "F:\Anaconda3\envs\yzdnlp\lib\multiprocessing\reduction.py", line 87, in steal_handle
    _winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE)
PermissionError: [WinError 5] 拒绝访问。

After search the issues online, I find the issue might be related to the unpicklable class on Windows but I haven't figured out how to hack the codes in Bleualign. Please help check this issue or bug. Thanks!

I don't have Windows so can't replicate the error or check a potential fix, but as a workaround, you can turn off multiprocessing by setting the number of processes to 1 (--processes 1 on the command line).

I don't have Windows so can't replicate the error or check a potential fix, but as a workaround, you can turn off multiprocessing by setting the number of processes to 1 (--processes 1 on the command line).

Thanks a lot for your prompt reply, Rico! It is now working.