[redland-dev] TypeError exceptions on destroy in Python API

Daniel Larsson daniel.larsson at servicefactory.com
Fri Aug 26 09:54:30 BST 2005


Jo Walsh wrote:

> hello,
>
> Every single time i interact with Redland via the python API, i see
> this error when the process ends, or one like it:
> Exception exceptions.TypeError: "'NoneType' object is not callable" in
> <bound method World.__del__ of <RDF.World object at 0xf6cbbb0c>>
> ignored
>
> This is from the version of python2.3-librdf that is in Debian
> testing.
>
>
Yes, I get this as well. I haven't tried digging too deeply into what is 
happening, but it seems there's a problem with the order of cleaning up.

*does some simple tests*

Ok, it seems (?) to be related to using packages. This is the simplest 
way I've found so far to exhibit the problem:

# test.py
import pkg.test2

# pkg/test2.py
import pkg.subpkg.test3

# pkg/subpkg/test3.py
import RDF

touch pkg/__init__.py
touch pkg/subpkg/__init__.py

When running this in verbose mode, I get this (much abbreviated):

$ python -v -v test.py
...
# cleanup __main__
# cleanup[2] pkg
# cleanup[2] pkg.test2
# cleanup[2] Redland
# clear[2] librdf_free_world
# cleanup[2] pkg.subpkg
# cleanup[2] RDF
# clear[1] _world
Exception exceptions.TypeError: "'NoneType' object is not callable" in 
<bound method World.__del__ of <RDF.World object at 0x81bec6c>> ignored

So it looks like the 'Redland' module is getting cleaned up before RDF!? 
This almost looks like a python problem...

> I have got used to tuning this out / grepping it from apache error
> logs etc, but i'd dearly love to get rid of it, especially as it makes
> users think something has gone wrong and i have to mention it in docs.
>
> My python-fu is not of the deepest. Can i get rid of this by overriding
> the moral equivalent of perl's DESTROY method somewhere in my own 
> application code? or do i have to jigger about with RDF.py itself, and 
> thereby make my fix less redistributable?
> any advice would be very much appreciated.
>
>
I've resorted to comment out the call to 
Redland.librdf_free_world(self._world) in RDF.py myself. I'm not sure 
how safe this is, however.

>
> zx
>
> _______________________________________________
> redland-dev mailing list
> redland-dev at lists.librdf.org
> http://lists.gnomehack.com/mailman/listinfo/redland-dev
>
>


More information about the redland-dev mailing list