PYTHON and gettign the ALPR module.

1,495 views
Skip to first unread message

Doug Jauregui

unread,
Apr 12, 2016, 10:58:37 AM4/12/16
to OpenALPR
I compiled  all dependencies to ALPR (leptonic, tesseract, and opencv )  Alll the latest Releases available.

So running alpr binary works and passing in a file. all works.

Next I was trying to get the python running with a sample from the openalpr sample python script.  I included references to the runtime and the conf but it gives the same error

But I always get this
from openalpr import Alpr

Do I have to add the openalpr folder inside the bindings directory into the PYHTON PATH?? when running my script , it is right above there inside the bindings directory, just trying a sample run.


Doug Jauregui

unread,
Apr 12, 2016, 11:46:32 PM4/12/16
to OpenALPR
Ok I found out my problem, I needed to include the python file under openalpr from what gets generated after the install.

Anyway now my problem is I'm getting the following error after trying to run the sample test.py


(cv) root@raspberrypi:~/openalpr-2.2.0/src/bindings/python/openalpr# python3 test.py /root/openalpr-2.2.0/ea7the.jpg
Traceback (most recent call last):
  File "test.py", line 21, in <module>
    alpr = Alpr(options.country, options.config, options.runtime_data)
  File "/root/openalpr-2.2.0/src/bindings/python/openalpr/openalpr.py", line 53, in __init__
    self.alpr_pointer = self._initialize_func(country, config_file, runtime_dir)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
(cv) root@raspberrypi:~/openalpr-2.2.0/src/bindings/python/openalpr#

Matt

unread,
Apr 15, 2016, 9:37:39 AM4/15/16
to OpenALPR
Support for Python3 was added in this commit: https://github.com/openalpr/openalpr/commit/6f41196763a97f5f5a64f9f78f2cb29bf3d26cda which was released after OpenALPR 2.2.  If you pull the latest Python binding, it should work with the latest code.  Or you could use Python2.

Doug Jauregui

unread,
Apr 15, 2016, 10:24:04 AM4/15/16
to OpenALPR
Yeah, but there were still some issues with the test.py sample and openalpr.py with  bytes to string and the other way around as well, minor things so I got it fixed.  it now works for both python 2.7 and python 3.4

So i got it working.  One silly mistake was the "from openalpr"  I failed to realize that my file openalpr did not exist at the same level as this python.  Had I added that other path into the python path it probably would have worked as well.

Matt

unread,
Apr 17, 2016, 8:46:35 AM4/17/16
to OpenALPR
Excellent.  If you found some compatibility issues in the Python bindings or the test sample, I'd be happy to merge the changes.

-Matt

Guru Vishnu

unread,
Feb 22, 2018, 1:07:36 PM2/22/18
to OpenALPR
Hi Doug,

Can you please elaborate on the following statement "One silly mistake was the "from openalpr"  I failed to realize that my file openalpr did not exist at the same level as this python", since I am getting the error in the "from openalpr import alpr" stmt and can you please let me know adding other path into python path.

Thanks
Guru
Reply all
Reply to author
Forward
0 new messages