-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
May I ask why "'type' object is not subscriptable" appears when running the code? #2
Comments
|
This is caused by python3.8 or previous versions, I wrote the code using python3.9. You can upgrade the python to 3.9. Here is an example: def func(li:list[str])->list[str]: # this will cause error in python 3.8 , but is right in 3.9 |
I have explained the cause of the error. The easiest way is to create a new python environment and install the dependencies under my repository. run this command conda create -n rl python=3.9
pip install -r requirements.txt Or, you must modify all def func(li:list[str])->list[str]: to def func(li): I write the code in such a way that I can know what the type of each variable is. |
thanks you. Can you give me an example? For example, "def sample(self) -> tuple[np.ndarray, t.ensor, t.ensor, t.ensor, t.ensor, t.ensor, t.ensor]: "What to change to |
Just delet all the return values! def sample(self): |
May I ask why "'type' object is not subscriptable" appears when running the code?
The text was updated successfully, but these errors were encountered: