Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am working on making License Plate Module for the below project and I am getting FileNotFoundError: [WinError 2] The system cannot find the file specified when running the project. It works fine using an interactive window

Project Link:
GitHub - codeproject/CodeProject.AI-Server: CodeProject SenseAI is a self contained service that software developers can include in, and distribute with, their applications in order to augment their apps with the power of AI.[^]

License Plate Module Link:
CodeProject.AI-Server/src/modules/ALPR at main · MikeLud/CodeProject.AI-Server · GitHub[^]

Works fine using an interactive window image
https://github.com/MikeLud/CodeProject.AI-Server/blob/main/src/modules/ALPR/wYNgt.png[^]

Shell
2022-10-29 15:32:56: Started License Plate Reader backend
2022-10-29 15:32:57: Traceback (most recent call last):
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\modules\ALPR\ALPR_adapter.py", line 15, in <module>
2022-10-29 15:32:57:     from ALPR import detect_platenumber
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\modules\ALPR\ALPR.py", line 14, in <module>
2022-10-29 15:32:57:     from paddleocr import PaddleOCR
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\AnalysisLayer\bin\windows\python37\venv\lib\site-packages\paddleocr\__init__.py", line 14, in <module>
2022-10-29 15:32:57:     from .paddleocr import *
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\AnalysisLayer\bin\windows\python37\venv\lib\site-packages\paddleocr\paddleocr.py", line 21, in <module>
2022-10-29 15:32:57:     import paddle
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\AnalysisLayer\bin\windows\python37\venv\lib\site-packages\paddle\__init__.py", line 71, in <module>
2022-10-29 15:32:57:     import paddle.dataset  # noqa: F401
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\AnalysisLayer\bin\windows\python37\venv\lib\site-packages\paddle\dataset\__init__.py", line 27, in <module>
2022-10-29 15:32:57:     import paddle.dataset.flowers  # noqa: F401
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\AnalysisLayer\bin\windows\python37\venv\lib\site-packages\paddle\dataset\flowers.py", line 39, in <module>
2022-10-29 15:32:57:     from paddle.dataset.image import load_image_bytes
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\AnalysisLayer\bin\windows\python37\venv\lib\site-packages\paddle\dataset\image.py", line 51, in <module>
2022-10-29 15:32:57:     stderr=subprocess.PIPE)
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\AnalysisLayer\bin\windows\python37\lib\subprocess.py", line 800, in __init__
2022-10-29 15:32:57:     restore_signals, start_new_session)
2022-10-29 15:32:57:   File "E:\Repos\CodeProject.AI-Server-1\src\AnalysisLayer\bin\windows\python37\lib\subprocess.py", line 1207, in _execute_child
2022-10-29 15:32:57:     startupinfo)
2022-10-29 15:32:57: FileNotFoundError: [WinError 2] The system cannot find the file specified
2022-10-29 15:32:57: ALPR_adapter.py: has exited


What I have tried:

Python
OCR='Paddle' # 'YOLO' or 'Paddle'

import io
from PIL import Image

from codeprojectai import CodeProjectAIRunner
from common import JSON
from analysislogging import LogMethod

from options import Options
opts = Options()

if OCR == 'Paddle':
    from paddleocr import PaddleOCR
    ocr = PaddleOCR(lang='en', rec_algorithm='CRNN', \
                    cls_model_dir='paddleocr/ch_ppocr_mobile_v2.0_cls_infer', \
                    det_model_dir='paddleocr/en_PP-OCRv3_det_infer', \
                    rec_model_dir='paddleocr/en_PP-OCRv3_rec_infer')

 try:
        # Convert to format suitable for a POST
        with io.BytesIO() as plate_buffer :
            image.save(plate_buffer, format='PNG')
            plate_buffer.seek(0)

            ocr_response = ocr.ocr(('image.png', plate_buffer, 'image/png'), cls=True)
Posted
Comments
Richard MacCutchan 30-Oct-22 4:27am    
Assuming that the error is caused by the last line above, I suspect that the file "image.png" was not saved to the current directory.
Mike Lud 30-Oct-22 12:56pm    
Thanks for your response, there is additional code before the try: that I did not include. The error happens before reaching this part of the code
Richard MacCutchan 30-Oct-22 16:11pm    
Sorry, but you need to tell us exactly where the error happens.
Mike Lud 31-Oct-22 21:12pm    
Richard the error is happening when PaddleOCR is being imported. Works fine using an interactive window so I know the package is installed correctly.

Richard MacCutchan 1-Nov-22 4:14am    
Well the error message is clear: the system cannot find the file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900