RatInABox-Lab / RatInABox

A python package for simulating 2D motion in continuous environment and spatial cell types (e.g. place cell).
MIT License
184 stars 31 forks source link

New python version bug #105

Closed TomGeorge1234 closed 6 months ago

TomGeorge1234 commented 6 months ago

@jquinnlee did you mentioned you'd come across a bug with latest version of python. Can you replicate it here so it might be fixed?

jquinnlee commented 6 months ago

@TomGeorge1234 you bet, it is actually not a problem with the latest version of Python, but versions <=3.8 To see the error, all you have to do is install ratinabox, and then import. Here, I have tried to import ratinabox in Python v3.7.13, and it kicks the following error:

import ratinabox
def agent_lookup(self, agent_names:Union[str, list[str]]  = None) -> list[Agent]:
TypeError: 'type' object is not subscriptable

The error does not occur in Python 3.9

Here is a possible reason for the error: https://stackoverflow.com/questions/63460126/typeerror-type-object-is-not-subscriptable-in-a-function-signature

TomGeorge1234 commented 6 months ago

good spot. I've just uploaded v1.12.3 where I switched from list to typing.List which fixes the issue such that python <= 3.9 are compatible again. You can pip reinstall and it should be good again!