[OpenLayers-Users] Problems setting up TileCache
Follower/OL
follower at rancidbacon.com
Mon Nov 27 04:14:35 EST 2006
While the TypeError error may well be solved by changing to a later
Python version, I feel the need to point out a bug in the code:
Christopher Schmidt wrote:
>Ben Wrote:
>>"/home/httpd/cf2/cgi-bin/tilecache-1.1/TileCache/Service.py", line 232,
>>in _loadFromSection
>>[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1] if opt not
>>in ("type"):
>>[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1] TypeError: 'in
>><string>' requires character as left operand
>
> However, it does explain why you got this message: Python2.2 doesn't
> support the construct:
> 'string' in ("type")
>
> A single element tuple is converted immediately to a string. (Python2.3
> and python 2.4 apparently don't do this.)
Please note that this:
("foo")
is *not* a single element tuple. See:
Python 2.3.5 (#1, Mar 20 2005, 20:38:20)
>>> type(("foo"))
<type 'str'>
But this is:
>>> type(("foo",))
<type 'tuple'>
(Note the trailing comma.)
That the construct doesn't throw a TypeError in 2.3+ doesn't mean it's
working correctly. Essentially, if the content of `opt` is a string then
it will never be true that 'opt' (a string) can be found in ("type")
(a sequence of single characters).
Hope this is some use... :-)
--Phil.
More information about the Users
mailing list