Login  Register

AttributeError: 'NoneType' object has no attribute 'storid'

classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

AttributeError: 'NoneType' object has no attribute 'storid'

AlGerl
3 posts
Dear Jiba,

to test our code, we are running unity tests with python. Within the unit test, we are creating (within one execution) several ontologies.

For example, we are testing six cases. For each case, we are creating a new ontology. The first case can be executed without any problem.
Within the second case, we get this error:

Traceback (most recent call last):
  File "C:\Users\XXX\Anaconda3\envs\preferml\lib\site-packages\owlready2\namespace.py", line 1364, in get_instances_of
    return [self.world._get_by_storid(o) for o in self._get_obj_triples_po_s(rdf_type, Class.storid)]

AttributeError: 'NoneType' object has no attribute 'storid'

After the first case, we created a new ontology with a new identifier (URI). However, we are getting always this error message.

Best regards
Alex
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: AttributeError: 'NoneType' object has no attribute 'storid'

Jiba
Administrator
1188 posts
Hi,

The error message indicates that Class is None in a call to get_instances_of().

If you design unit test, I highly recommend you to use a separate World for each test (and not just different ontologies). This will prevent a test to pollute another one.

Jiba