Lesson 1 - Semantic Search:TypeError: 'NoneType' object is not iterable

Anyone runs into the same error as me do?if INDEX_NAME in [index.name for index in pinecone.list_indexes()] get an error 'NoneType' object is not iterable
`

pinecone = Pinecone(api_key=PINECONE_API_KEY)
INDEX_NAME = utils.create_dlai_index_name('dl-ai')

if INDEX_NAME in [index.name for index in pinecone.list_indexes()]:
    pinecone.delete_index(INDEX_NAME)
print(INDEX_NAME)
pinecone.create_index(name=INDEX_NAME, 
    dimension=model.get_sentence_embedding_dimension(), 
    metric='cosine',
    spec=ServerlessSpec(cloud='aws', region='us-west-2'))

index = pinecone.Index(INDEX_NAME)
print(index)

Hi @Shengxin_Huang
You can use print() to see the variable value. Probably you are trying to use a not initialized variable.
Keep learning!

There is an error in the example code in google colab


TypeError Traceback (most recent call last)
Cell In[58], line 4
1 pinecone = Pinecone(api_key=PINECONE_API_KEY)
2 INDEX_NAME = utils.create_dlai_index_name(‘dl-ai’)
----> 4 if INDEX_NAME in [index.name for index in pinecone.list_indexes()]:
5 pinecone.delete_index(INDEX_NAME)
6 print(INDEX_NAME)

File /usr/local/lib/python3.10/site-packages/pinecone/models/index_list.py:18, in IndexList.iter(self)
17 def iter(self):
—> 18 return iter(self.index_list.indexes)

TypeError: ‘NoneType’ object is not iterable

Did you find any solution?

gosh … nobody is answering that issue.
quite hardcore start, actually

error not corrected