Issue 22 in pylibtiff: import libtiff fails

36 views
Skip to first unread message

pyli...@googlecode.com

unread,
Oct 16, 2012, 6:13:23 PM10/16/12
to pylibtif...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 22 by msch...@gmail.com: import libtiff fails
http://code.google.com/p/pylibtiff/issues/detail?id=22

--problem--:
1) can't eval (1
2) TIFFTAG_* undefined

--solution--:
sed -i "s/\.split()\[:2\]/\.split(None,1)/;\
s/eval(value)/eval(value,d)/" libtiff/libtiff_ctypes.py

python=2.7.3
libtiff=4.0.3

pyli...@googlecode.com

unread,
Apr 23, 2013, 5:08:22 PM4/23/13
to pylibtif...@googlegroups.com

Comment #1 on issue 22 by dho...@gmail.com: import libtiff fails
http://code.google.com/p/pylibtiff/issues/detail?id=22

I looked into this and will try to fix it today. The problem is in the
4.0.3 header starting with this line:

#define CODINGMETHODS_T4_1D (1 << 1) /* !T.4 1D */

Since the value has spaces in it the string filtering cuts off everything
after "(1" which isn't valid python. The proposed solution doesn't seem to
work for me, I'm looking into it now. And unless I'm missing something
the "eval(value,d)" shouldn't be needed since there is a "if value in d"
check right above that.

The proposed solution fails on my machine because it doesn't remove the
whitespace after "FAXMODE_NORTC" and then doesn't match in the dictionary.
Still doesn't solve the TIFFTAG_COLORMAP undefined problem either.

Thanks for reporting the bug.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

pyli...@googlecode.com

unread,
Apr 23, 2013, 5:25:29 PM4/23/13
to pylibtif...@googlegroups.com

Comment #2 on issue 22 by pearu.peterson: import libtiff fails
http://code.google.com/p/pylibtiff/issues/detail?id=22

I have a fix to this bug (I have forgotten to commit it).
Will commit in a moment or so.

pyli...@googlecode.com

unread,
Apr 23, 2013, 5:55:40 PM4/23/13
to pylibtif...@googlegroups.com

Comment #3 on issue 22 by dho...@gmail.com: import libtiff fails
http://code.google.com/p/pylibtiff/issues/detail?id=22

Thanks, I'll try it out. FYI here is my fix:

Index: libtiff/libtiff_ctypes.py
===================================================================
--- libtiff/libtiff_ctypes.py (revision 90)
+++ libtiff/libtiff_ctypes.py (working copy)
@@ -71,11 +71,11 @@
d = {}
for line in f.readlines():
if not line.startswith('#define'): continue
- words = line[7:].lstrip().split()[:2]
+ words = line[7:].lstrip().split(None, 1)[:2]
if len (words)!=2: continue
name, value = words
i = value.find('/*')
- if i!=-1: value = value[:i]
+ if i!=-1: value = value[:i].strip()
if value in d:
value = d[value]
else:

pyli...@googlecode.com

unread,
May 22, 2013, 3:55:37 AM5/22/13
to pylibtif...@googlegroups.com
Updates:
Status: Fixed

Comment #4 on issue 22 by pearu.peterson: import libtiff fails
http://code.google.com/p/pylibtiff/issues/detail?id=22

I presume the issue is Fixed. Please open when the issue persists.
Reply all
Reply to author
Forward
0 new messages