[Mapserver-users] TypeError-Problem with Python Mapscript

Sean Gillies sgillies at frii.com
Thu Nov 20 11:41:21 EST 2003


On Thursday, November 20, 2003, at 07:50  AM, Bjoern Platzen wrote:

> Hi List,
>
> I just loaded my PyMapScript application onto the webserver.
>
> But now I get Errors, that I didn't get on my machine (They're both 
> SuSE
> Linux 8.0, Mapserver 3.6.5 & Mapscript compiled with the same options).
>
> This is what I get on the shell:
>>>> import mapscript
>>>> mymap =
> mapscript.mapObj('/usr/local/httpd/htdocs/bauinfo/bauinfo.map')
>>>> mymap
> <C mapObj instance at None>
>>>> ip=mymap.web.imagepath
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: Type error. Expected _p_mapObj
>>>> mymap.__dict__
> {'this': None, 'thisown': 1}
>>>> mymap.extent.minx
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: Type error. Expected _p_mapObj
>
> It seems as if the mapObj() isn't built properly
> -> <C mapObj instance at None>
>                         ^^^^^^
> I think there should be something like
> -> <C mapObj instance at _08d0a240_p_mapObj>
>                          ^^^^^^^^^^^^^^^^^^
>
> Has anyone an idea, of what could cause that the mapObj() isn't build
> right?
>
> Any help would be great!
>
> Thanks,
>
> Bjoern.
> -- 
> small office solutions
> info at sosnetz.de  -  http://www.sosnetz.de
>

Bjoern,

Here's what I do to troubleshoot using the Python interpreter.  Rather 
than
look through the file permissions and all, I go straight to the Python
interpreter and see what sort of errors are raised.

First, start an interpreter as your httpd user.  For me, this is 
'nobody'.

bash-2.05a$ sudo -u nobody python2.3
Python 2.3 (#6, Sep 14 2003, 15:46:16)
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>>

Next, see if you can stat the mapfile.  This will let you know that your
path is correct.

 >>> import os
 >>> mapfile = '/usr/local/apache2/htdocs/rg/or.map'
 >>> os.stat(mapfile)
(33188, 1712073L, 234881029L, 1, 501, 0, 12530L, 1069298287, 
1069298267, 1069298287)
 >>>

Now see if you can open the mapfile.  If your permissions are OK, you 
should
see this:

 >>> fh = open(mapfile, 'r')
 >>>

If your permissions are wrong, you'd get

 >>> fh = open(mapfile, 'r')
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
IOError: [Errno 13] Permission denied: 
'/usr/local/apache2/htdocs/rg/or.map'

I suspect that if permissions aren't the problem with your mapfile, you
are experiencing problems with other paths defined in your mapfile that
are now invalid after switching hosts.  fontset, symbolset, shapepath, 
etc.
Are these OK?

Sean

P.S., if you respond to this, please follow my lead and post at the
bottom.  thanks!



--
Sean Gillies
sgillies at frii dot com
http://www.frii.com/~sgillies




More information about the mapserver-users mailing list