You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can't really use ocropy as a library right now because data loading and actual functionality is so intermeshed in the main scripts and most of them also implicitely assume a certain layout of the data on the file system. The last time I tried I just called them using the subprocess module but then went on to refactor everything just because ensuring that all the pseg,nrm,.... files are in the correct location is a pain.
f you want a clean-ish API with mostly the same functionality you might want to look at kraken. The documentation is admittedly lacking but just throwing a PIL image at most functions is a lot nicer than working around each script's peculiarities.
Hi All,
What is suggested way to run ocropy scripts from other python code?
The most recommended way is to us "import " but:
Could scripts be wrapped into standard:
if name == "main":
main()
sys.exit(0)
Some further minor teaks to map args.* to other variables in main code.
The idea is to avoid duplication of code included in scripts, i.e threshold calculation, etc. and have it re-usable.
The other methods considered for today is to use:
Other options I've looked at are listed here:
https://stackoverflow.com/questions/2349991/python-how-to-import-other-python-files/20749411#20749411
Another option could be one of demonstrated approaches (0,1 or 2):
https://m8051.blogspot.com/2014/02/python-tricks-running-python-scripts.html
The text was updated successfully, but these errors were encountered: