Problems setting up TileCache

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems setting up TileCache

Ben Brehmer
Hello Everyone,

I have setup a very basic Open Layers application and am now in the
process of setting up TileCache. I have proded and poked my
tilecache.cfg file extensively and still can't get past an error which
has to do with with the "type" attribute for the [cache] section.
Basically when tilecache.cgi is invoked it never gets past parsing the
.cfg file and errors out at the "type=DiskCache" line, saying that the
string requires a character as left operand.

Is there some other configuration issues I should know about when
setting up TileCache?




Error and cfg file details:

tilecache.cfg file:

[cache]
type=DiskCache                                        <-----------Error
base=/home/httpd/cf2/html/tilecache/
[basic]
type=WMSLayer
url=http://office.refractions.net/ms/cgi-bin/mapserv
extension=png



The error I pull out of my error log:

TypeError:
'in <string>' requires character as left operand




Thanks,

Ben





_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problems setting up TileCache

Christopher Schmidt-2
On Tue, Nov 21, 2006 at 03:10:17PM -0800, Ben Brehmer wrote:

> Hello Everyone,
>
> I have setup a very basic Open Layers application and am now in the
> process of setting up TileCache. I have proded and poked my
> tilecache.cfg file extensively and still can't get past an error which
> has to do with with the "type" attribute for the [cache] section.
> Basically when tilecache.cgi is invoked it never gets past parsing the
> .cfg file and errors out at the "type=DiskCache" line, saying that the
> string requires a character as left operand.
>
> Is there some other configuration issues I should know about when
> setting up TileCache?
>
>
>
>
> Error and cfg file details:
>
> tilecache.cfg file:
>
> [cache]
> type=DiskCache                                        <-----------Error
> base=/home/httpd/cf2/html/tilecache/
> [basic]
> type=WMSLayer
> url=http://office.refractions.net/ms/cgi-bin/mapserv
> extension=png
>
>
>
> The error I pull out of my error log:
>
> TypeError:
> 'in <string>' requires character as left operand

Oddly enough, this sounds like a bug in ConfigParser more than anything
else... Do the logs give you any kind of traceback or anything like a
line number where the error is happening?

We're using Python2.4 for our TileCache workings, but I know that people
have got it running under 2.3 -- this error is definitely something you
wouldn't see under Python2.4, but I don't know if that would fix your
problem.

I've just downloaded a clean TileCache 1.1, and edited tilecache.cgi to
use Python2.3, and I'm not getting this error, unfortunately. If you
could give any more information as to where in the code this error is
happening, I'd appreciate it, and will investigate as best I can.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problems setting up TileCache

Ben Brehmer
Christopher Schmidt wrote:

> On Tue, Nov 21, 2006 at 03:10:17PM -0800, Ben Brehmer wrote:
>  
>> Hello Everyone,
>>
>> I have setup a very basic Open Layers application and am now in the
>> process of setting up TileCache. I have proded and poked my
>> tilecache.cfg file extensively and still can't get past an error which
>> has to do with with the "type" attribute for the [cache] section.
>> Basically when tilecache.cgi is invoked it never gets past parsing the
>> .cfg file and errors out at the "type=DiskCache" line, saying that the
>> string requires a character as left operand.
>>
>> Is there some other configuration issues I should know about when
>> setting up TileCache?
>>
>>
>>
>>
>> Error and cfg file details:
>>
>> tilecache.cfg file:
>>
>> [cache]
>> type=DiskCache                                        <-----------Error
>> base=/home/httpd/cf2/html/tilecache/
>> [basic]
>> type=WMSLayer
>> url=http://office.refractions.net/ms/cgi-bin/mapserv
>> extension=png
>>
>>
>>
>> The error I pull out of my error log:
>>
>> TypeError:
>> 'in <string>' requires character as left operand
>>    
>
> Oddly enough, this sounds like a bug in ConfigParser more than anything
> else... Do the logs give you any kind of traceback or anything like a
> line number where the error is happening?
>
> We're using Python2.4 for our TileCache workings, but I know that people
> have got it running under 2.3 -- this error is definitely something you
> wouldn't see under Python2.4, but I don't know if that would fix your
> problem.
>
> I've just downloaded a clean TileCache 1.1, and edited tilecache.cgi to
> use Python2.3, and I'm not getting this error, unfortunately. If you
> could give any more information as to where in the code this error is
> happening, I'd appreciate it, and will investigate as best I can.
>
> Regards,
>  
Hi Christopher,

This is the complete error log:

[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1] Traceback (most
recent call last):
[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]   File
"/home/httpd/cf2/cgi-bin/tilecache-1.1/tilecache.cgi", line 6, in ?
[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]     svc =
Service.load(*cfgfiles)
[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]   File
"/home/httpd/cf2/cgi-bin/tilecache-1.1/TileCache/Service.py", line 249,
in _load
[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]     cache =
cls.loadFromSection(config, "cache", Cache)
[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]   File
"/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
[Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1] Premature end
of script headers: tilecache.cgi


I definitely agree with you that this is a problem in ConfigParser,
although this may be related to me using Python 2.2.3. I am going to
install Python 2.4 this morning. I"ll let you know if that was the cause
of my problems.

Thanks for you help,

Ben
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problems setting up TileCache

Christopher Schmidt-2
On Wed, Nov 22, 2006 at 08:56:29AM -0800, Ben Brehmer wrote:

> Christopher Schmidt wrote:
> >We're using Python2.4 for our TileCache workings, but I know that people
> >have got it running under 2.3 -- this error is definitely something you
> >wouldn't see under Python2.4, but I don't know if that would fix your
> >problem.
> >
> >I've just downloaded a clean TileCache 1.1, and edited tilecache.cgi to
> >use Python2.3, and I'm not getting this error, unfortunately. If you
> >could give any more information as to where in the code this error is
> >happening, I'd appreciate it, and will investigate as best I can.
> >
> >Regards,
> >  
> Hi Christopher,
>
> This is the complete error log:
>
> [Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1] Traceback (most
> recent call last):
> [Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]   File
> "/home/httpd/cf2/cgi-bin/tilecache-1.1/tilecache.cgi", line 6, in ?
> [Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]     svc =
> Service.load(*cfgfiles)
> [Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]   File
> "/home/httpd/cf2/cgi-bin/tilecache-1.1/TileCache/Service.py", line 249,
> in _load
> [Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]     cache =
> cls.loadFromSection(config, "cache", Cache)
> [Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1]   File
> "/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
> [Wed Nov 22 08:48:23 2006] [error] [client 192.168.50.1] Premature end
> of script headers: tilecache.cgi
>
>
> I definitely agree with you that this is a problem in ConfigParser,
> although this may be related to me using Python 2.2.3. I am going to
> install Python 2.4 this morning. I"ll let you know if that was the cause
> of my problems.

Ah, 2.2 is not supported -- I don't have it available on the machine I"m
using, or on the server :)

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.)

To test whether it works with 2.2, you can change ("type") to ['type']
on line 232 of TileCache/Service.py: in a quick test on my local copy of
TileCache, this works, but we have thus far not put any effort into
maintaining compatibility with 2.2, only 2.3 and up.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problems setting up TileCache

Follower/OL
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.
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problems setting up TileCache

Christopher Schmidt-2
On Mon, Nov 27, 2006 at 10:14:35PM +1300, Follower/OL wrote:

> 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... :-)

When working around the bug, I noticed that, but it does seem that Python
*does* treat "foo" in ("foo") as true... Oh, I see why, it's because it
supports that operation on operators. So, with the single element, we
should probably just change that to a string and check equality. I think
that's there for 'historical reasons' :)

Thanks for the catch.

Regards,
--
Christopher Schmidt
MetaCarta
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users