1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
README for pydmtx version 0.7.2 - September 4, 2009
-----------------------------------------------------------------
pydmtx is a thin wrapper around libdmtx that reads and writes
Data Matrix barcodes as PIL Image objects. Dan Watson wrote the
original version of pydmtx in 2006, and allowed it to become a
native part of the libdmtx package.
1. libdmtx Installation
-----------------------------------------------------------------
libdmtx must be installed on your system before trying to install
and run the Python wrapper. Refer to the INSTALL file in the main
libdmtx directory for instructions on how to do this.
2. pydmtx Installation
-----------------------------------------------------------------
After libdmtx is present, next install pydmtx by running the
following command as root:
$ python setup.py install
Once installed, you can verify it works by running as yourself:
$ python test.py
3. Troubleshooting
-----------------------------------------------------------------
3.1. ImportError: libdmtx.so.0: cannot open shared object file
This error indicates it is not able to find the libdmtx library.
There are a few ways to fix this. You can make a temporary local
session fix:
$ export LD_LIBRARY_PATH=/usr/local/lib
... or make a permanent fix that requires root privileges:
$ /sbin/ldconfig /usr/local/lib
Alternatively, you could edit /etc/ld.so.conf to include
/usr/local/lib (which also requires root privileges).
When it is working properly the test.py script should create an
image named 'hello.png' in the current directory. The image
should be a Data Matrix barcode that scans to "hello, world".
3.2. SystemError: NULL result without error in PyObject_Call
Could mean that you're passing in a 1 bit b/w image instead of a
RGB image. This is a good guard against that:
img = Image.open( f )
if img.mode != 'RGB':
img = img.convert('RGB')
print dm_read.decode( img.size[0], img.size[1], buffer(img.tostring()) )
3. Dependencies
-----------------------------------------------------------------
These packages are required to install and run pydmtx:
Python: http://www.python.org
PIL: http://www.pythonware.com/products/pil
If you are using an RPM-based system then you can test for the
following packages:
python
python-devel
python-imaging
4. This Document
-----------------------------------------------------------------
This document is derived from the wiki page located at:
http://libdmtx.wikidot.com/libdmtx-python-wrapper
If you find an error or have additional helpful information,
please edit the wiki directly with your updates.
|