Menu

#3 exception due to typo?

open
nobody
None
5
2012-12-13
2012-12-13
Dave Nelson
No

Installed pyexif-0.9. Used Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32.
Ran a simple program on a number of files.
Got the exception:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
execfile(f)
File "C:/Users/Dave/My Documents/Python/Search_JPEG_files.py", line 99, in <module>
main()
File "C:/Users/Dave/My Documents/Python/Search_JPEG_files.py", line 20, in main
do_dir(dir_list[0], dir_list)
File "C:/Users/Dave/My Documents/Python/Search_JPEG_files.py", line 35, in do_dir
tags = exif.parse(fpath)
File "C:\Python27\lib\site-packages\exif.py", line 659, in parse
value_map = parse_tiff(tiff, mode)
File "C:\Python27\lib\site-packages\exif.py", line 570, in parse_tiff
offset = parse_ifd(tiff, mode, offset, value_map)
File "C:\Python27\lib\site-packages\exif.py", line 560, in parse_ifd
parse_tag(tiff, mode, value_map, TAG_MAP)
File "C:\Python27\lib\site-packages\exif.py", line 537, in parse_tag
value_table = type.read(tiff, count)
File "C:\Python27\lib\site-packages\exif.py", line 107, in read
for i in range(0, count): table.append(tiff.byte())
NameError: global name 'table' is not defined

Looked at the code and it appears to me to be a simple typo.

in exif.py line 106 is the statement "result = []"
However result isn't used, instead 'table' is used.
Changing line 106 to be "table = []" eliminates the error. Also, many other functions in that area have the "table = []" line.

Program then ran fine.
Thanks for the hard work. Before trying this, I tried the similarly named by completely different module EXIF.PY, which didn't work for me.

--Dave

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.