Traceback (most recent call last): File "E:\Anaconda3\anaconda3\envs\paddle\lib\site-packages\flask\app.py", line 2525, in wsgi_app response = self.full_dispatch_request() File "E:\Anaconda3\anaconda3\envs\paddle\lib\site-packages\flask\app.py", line 1822, in full_dispatch_request rv = self.handle_user_exception(e) File "E:\Anaconda3\anaconda3\envs\paddle\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request rv = self.dispatch_request() File "E:\Anaconda3\anaconda3\envs\paddle\lib\site-packages\flask\app.py", line 1796, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "D:/job/毕设/模型训练/pdWork/app.py", line 21, in predict image = Image.open(image) File "E:\Anaconda3\anaconda3\envs\paddle\lib\site-packages\PIL\Image.py", line 3233, in open fp = io.BytesIO(fp.read()) AttributeError: 'NoneType' object has no attribute 'read' 127.0.0.1 - - [24/May/2023 21:13:25] "POST /predict HTTP/1.1" 500 - 127.0.0.1 - - [24/May/2023 21:14:54] "GET / HTTP/1.1" 200 -
时间: 2023-06-30 20:07:49 浏览: 222
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这个错误信息是在 Flask 应用中出现的,提示在打开图片时发生了异常。具体原因是在读取图片时,传入的参数为 None,导致没有读取到图片数据,进而无法进行后续的操作。
建议检查代码,在调用 `Image.open()` 方法时,确保传入的参数是正确的图片路径。或者也有可能是请求中没有上传图片,需要确认一下。
阅读全文