Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'imgs' referenced before assignment #5

Open
19157681683 opened this issue May 13, 2024 · 4 comments

Comments

@19157681683
Copy link

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/root/anaconda3/envs/pdf_md/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/root/anaconda3/envs/pdf_md/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/x32001214/data_handle/MAP-NEO-main/Matrix/document-convert/multi_thread_process_to_doc.py", line 169, in process_predict
images = read_image(pdf_info[0])
File "/x32001214/data_handle/MAP-NEO-main/Matrix/document-convert/utils.py", line 1418, in read_image
return imgs
UnboundLocalError: local variable 'imgs' referenced before assignment
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/x32001214/data_handle/MAP-NEO-main/Matrix/document-convert/multi_thread_process_to_doc.py", line 348, in
pool.map(process_predict, file_info)
File "/root/anaconda3/envs/pdf_md/lib/python3.9/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/root/anaconda3/envs/pdf_md/lib/python3.9/multiprocessing/pool.py", line 771, in get
raise self._value
UnboundLocalError: local variable 'imgs' referenced before assignment

@Miki-lin
Copy link

image
I meet the same problem in running the multi_thread_process_to_doc.py, please tell me how to deal with this, thanks!

@19157681683
Copy link
Author

这个直接把Imgs放到循环前面

@19157681683
Copy link
Author

可以把问题,代码片段一起提交给DeepSeek/ChatGPT,然后跟着排错/调试就ok了

@Miki-lin
Copy link

我找到问题了,PDF那个文件夹下面不能包括输出的路径,最好是只有检测的PDF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants