PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

Fixing emptystring when appending `paddleocr.py` directory to PYTHONPATH

Open tymons opened this issue 1 year ago • 1 comments

Problem

I was trying to use paddleocr within my bazel monorepository. As bazel working directory is different than directory of __file__ I was experiencing error same as in #1024. No tools.infer module was found. I noticed that os.path.dirname(__file__) returns empty string when paddleocr.py is executed from parent directory. I believe the intention was to extend PYTHONPATH with absolute path of paddleocr.py directory.

Fix

Modify __dir__ variable to be absolute path, not relative one. This will help to address issue #1024 as no real fix was applied so far.

tymons avatar Mar 17 '23 12:03 tymons