OpenBMB / ChatDev

Create Customized Software using Natural Language Idea (through LLM-powered Multi-Agent Collaboration)
https://arxiv.org/abs/2307.07924
Apache License 2.0
24.38k stars 3.06k forks source link

TypeError: 'type' object is not subscriptable #358

Closed Eth030 closed 3 months ago

Eth030 commented 3 months ago

Traceback (most recent call last): File "run.py", line 24, in from chatdev.chat_chain import ChatChain File "/home/issa/code/ai/ChatDev/chatdev/chat_chain.py", line 12, in from chatdev.chat_env import ChatEnv, ChatEnvConfig File "/home/issa/code/ai/ChatDev/chatdev/chat_env.py", line 52, in class ChatEnv: File "/home/issa/code/ai/ChatDev/chatdev/chat_env.py", line 107, in ChatEnv def exist_bugs(self) -> tuple[bool, str]: TypeError: 'type' object is not subscriptable root@ubuntu:/home/issa/code/ai/ChatDev#

wyifei26 commented 3 months ago

The error message you're encountering, TypeError: 'type' object is not subscriptable, typically arises when you attempt to use subscript notation (i.e., square brackets []) with a type that doesn't support this operation. This is a common issue when trying to use the newer type hinting syntax introduced in Python 3.9 with versions of Python that are older than 3.9.

In Python 3.9 and later, standard collection types such as list, dict, set, and tuple support direct use of square brackets for type annotations, which is not the case in earlier versions. If feasible, consider upgrading your Python environment to version 3.9 or newer. This will allow you to use the new type annotation syntax without encountering this issue.