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

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

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

AlGerl
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
|

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

Jiba
Administrator
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