[mapserver-users] Building Mapscript/Python
Thorsten Fischer
thfischer at mapmedia.de
Fri Aug 31 05:48:50 PDT 2001
Jean-Francois,
This posting is about a week old, I apologise if it was answered before but I
do not follow the list very closely at the moment.
> This is funny, but how do I initialize a mapObj in Python ? There's no "new"
> method on any of the objects (classes in this case). I found the __init__
> function, but when I try to call it I get:
> TypeError: unbound method __init__() must be called with instance as first
> argument
I have not built python/mapscript yet, but I know a bit of python. In Python,
to create an instance of an object you do something like:
map = mapObj ("/home/mapdata/legalsurveys/test.map")
The method __init__ is the constructor of a class, which is always defined as
something like
def __init__ (self, ...)
So if you do the call described above, it passes its own instance and then the
arguments to the constructor. You do not call any new() function or the
__init__ thing directly.
> I may have to pre-decalre an "empty" object first, but I haven't found out
> how to do that yet :)
No. Never. This is python =)
> Seems to me we really should get a Mapscript/Python doc going :P
For the compiling process maybe, the above is general python knowledge.
hope that helps,
thorsten
--
Thorsten Fischer thfischer at mapmedia.de
---------------------------------------------------------
MapMedia - Kartographie und raumbezogene Informationssysteme
Am Borsigturm 42
13507 Berlin
Deutschland
http://www.mapmedia.de tel: +49 (0)30 43032102
---------------------------------------------------------
More information about the MapServer-users
mailing list