Firstly, I am aware of this similar SO Question but my problem is slightly different and the answer in that question did not solve my problem. So, I am creating a new post here.
I have downloaded Zbar Installler from http://zbar.sourceforge.net/download.html and managed to successfully(no error message) installed.
But, when i run the following script,
import zbar
from PIL import Image
# create a reader
scanner = zbar.ImageScanner()
# configure the reader
scanner.parse_config('enable')
# obtain image data
pil = Image.open('zbartest2.png').convert('L')
width, height = pil.size
raw = pil.tostring()
# wrap image data
image = zbar.Image(width, height, 'Y800', raw)
# scan the image for barcodes
scanner.scan(image)
# extract results
for symbol in image:
# do something useful with results
print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data
# clean up
del(image)
It give me the error message saying that DLL load fail.
Traceback (most recent call last):
File "D:\Profiles\e492507\Desktop\barcode reader\test.py", line 1, in import zbar ImportError: DLL load failed: The specified module could not be found.
but unlike the similar SO question i mentioned above, when i type this in the python IDLE shell, it works without any problem.
import zbar
zbar.version()
(0, 10)
What is causing the problem and how do i fix it?
FYI: I am using Python 2.7.3 on windows Xp pro 32 bits
UPDATE: 1
I found out that if i copy the script and image into python directory C:\Python27\ it works fine without any problem.
However, as soon as i move the script and image into other places, i got the same error message i posted above.
How should i fix this so that i can execute my script anywhere in my computer as long as the barcode image is available?
UPDATE: 2 (JUST FOR INFO: NOT DIRECTLY RELATED TO THE QUESTION)
I am not able to solve this problem using all the methods i have discovered so far.So, i am coming out with my own silly solution.
I am going to use a simple table drawn by reportlab instead of Barcodes and color the cells accordingly ( black for 1 and white for 0) to represents the numbers in binary.
So, number 69 will be something like this

Then, i can use PIL to detect the black and white squares and covert it back into binary then to decimal. FYI, i am only dealing with the decimal numbers. No alphabets nor other stuffs. I know this is pretty silly but desperate times call for desperate measures :P