[Zope] External Methods: Object behavior different in 2.4.2 ?
Andy McKay
andym@ActiveState.com
Tue, 30 Oct 2001 13:14:25 -0800
So it looks like the error occurs outside of Zope, in your library... wha=
t
has that got to do with 2.4.2?
Cheers.
--
Andy McKay.
----- Original Message -----
From: "Doyon, Jean-Francois" <Jean-Francois.Doyon@CCRS.NRCan.gc.ca>
To: <zope@zope.org>
Sent: Tuesday, October 30, 2001 1:04 PM
Subject: [Zope] External Methods: Object behavior different in 2.4.2 ?
> Hello,
>
> I have an External Method that imports a module that in turn imports a
> Python/C library ... (A SWIG'ified software with shadow classes).
>
> This used to work fine in 2.4.1 ... But now in 2.4.2 I am having proble=
ms:
>
> It seems I can only run it once! If I hit refresh or something like tha=
t,
I
> get the following error:
>
> Traceback (innermost last):
> File /usr/local/Zope-2.4.2/lib/python/ZPublisher/Publish.py, line 223=
,
in
> publish_module
> File /usr/local/Zope-2.4.2/lib/python/ZPublisher/Publish.py, line 187=
,
in
> publish
> File /usr/local/Zope-2.4.2/lib/python/Zope/__init__.py, line 226, in
> zpublisher_exception_hook
> (Object: Zope)
> File /usr/local/Zope-2.4.2/lib/python/ZPublisher/Publish.py, line 171=
,
in
> publish
> File /usr/local/Zope-2.4.2/lib/python/ZPublisher/mapply.py, line 160,=
in
> mapply
> (Object: drawmap)
> File /usr/local/Zope-2.4.2/lib/python/ZPublisher/Publish.py, line 112=
,
in
> call_object
> (Object: drawmap)
> File
>
/usr/local/Zope-2.4.2/lib/python/Products/ExternalMethod/ExternalMethod.p=
y,
> line 274, in __call__
> (Object: drawmap)
> (Info: ((400, 340, 'left'), {}, (400, 340, 'left')))
> File /usr/local/Zope-2.4.2/Extensions/mapserver.py, line 6, in drawma=
p
> File /usr/lib/python2.1/mapscript.py, line 1041, in __setattr__
> TypeError: Type error. Expected _p_mapObj
>
> And on the console:
>
> Exception exceptions.TypeError: 'Type error. Expected _p_mapObj' in
<method
> mapObj.__del__ of mapObj instance at 0x895bafc> ignored
>
> Here is the code, it is short:
>
> from mapscript import *
> import tempfile
>
> def drawmap(width=3D400,height=3D340,align=3D"left"):
> mymap =3D mapObj("/home/mapdata/nac/177.map")
> mymap.width =3D width
> mymap.height =3D height
> myimage =3D mymap.draw()
> oldtempdir =3D tempfile.tempdir
> tempfile.tempdir =3D ""
> mytempfile =3D tempfile.mktemp()
> tempfile.tempdir =3D oldtempdir
>
>
msSaveImage(myimage,"/usr/local/apache/htdocs/tempimages/"+mytempfile,0,0=
,0,
> 0)
> return "<IMG SRC=3Dhttp://localhost/tempimages/"+mytempfile+"
> ALIGN=3D"+align+" BORDER=3D0>"
>
> Note the "mapObj" called "mymap" ... It does all the work. From what I
see
> above, once the object is instanciated, there's a problem destroying it=
,
or
> instantiating a new one ... This might be why I get th error above.
>
> Funny thing is this worked fine in 2.4.1 ... Is this a bug, or did some
sort
> of behavior change with 2.4.2? And if so how do I get around it?
>
> I tried adding a "mymap =3D None" here and there to force the object to=
be
> destroyed after/before use, but that didn't seem to help.
>
> Any ideas?
>
> Thanks in advance,
>
> Jean-Fran=E7ois Doyon
> Internet Service Development and Systems Support
> GeoAccess Division
> Canadian Center for Remote Sensing
> Natural Resources Canada
> http://atlas.gc.ca
> Phone: (613) 992-4902
> Fax: (613) 947-2410
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>