---
title: "Comment by Mayur Ghadge on \"Building an Interactive Chatbot with Langchain, ChatGPT, Pinecone, and Streamlit\" | Hashnode"
description: "How to connect indexing.py file with main.py in streamlit. I am getting an error, can you please help me."
url: "https://hashnode.com/posts/building-an-interactive-chatbot-with-langchain-chatgpt-pinecone-and-streamlit/646a39eae56ee64c3d800e77/comment/64904c48aa3e031681680e57"
---

[Discussion](https://hashnode.com/posts/building-an-interactive-chatbot-with-langchain-chatgpt-pinecone-and-streamlit/646a39eae56ee64c3d800e77)

Comment [Building an Interactive Chatbot with Langchain, ChatGPT, Pinecone, and Streamlit](https://hashnode.com/posts/building-an-interactive-chatbot-with-langchain-chatgpt-pinecone-and-streamlit/646a39eae56ee64c3d800e77)

[Mayur Ghadge](https://hashnode.com/@mayursinh9007)

[Jun 19, 2023](https://hashnode.com/posts/building-an-interactive-chatbot-with-langchain-chatgpt-pinecone-and-streamlit/646a39eae56ee64c3d800e77/comment/64904c48aa3e031681680e57)

How to connect indexing.py file with main.py in streamlit. I am getting an error, can you please help me.

[Versace](https://hashnode.com/@Versace)

[Jun 29, 2023](https://hashnode.com/posts/building-an-interactive-chatbot-with-langchain-chatgpt-pinecone-and-streamlit/646a39eae56ee64c3d800e77/comment/64904c48aa3e031681680e57#reply-649cde517fcfbd9ddc25bcc0)

i run the indexing.py file with the terminal and the pinecone write in the file

[Sarit Bahuguna](https://hashnode.com/@sarit545)

[Nov 30, 2023](https://hashnode.com/posts/building-an-interactive-chatbot-with-langchain-chatgpt-pinecone-and-streamlit/646a39eae56ee64c3d800e77/comment/64904c48aa3e031681680e57#reply-6568198884ca99a5e618353c)

**When I Run indexing.py file with the terminal** **This is Code indexing.py**

from langchain.document\_loaders import DirectoryLoader from langchain.text\_splitter import RecursiveCharacterTextSplitter import os

directory = '/data/SwiftProgrammingLanguage.pdf'

def load\_docs(directory): loader = DirectoryLoader(directory) documents = loader.load() return documents

documents = load\_docs(directory) len(documents)

def split\_docs(documents,chunk\_size=500,chunk\_overlap=20): text\_splitter = RecursiveCharacterTextSplitter(chunk\_size=chunk\_size, chunk\_overlap=chunk\_overlap) docs = text\_splitter.split\_documents(documents) return docs

docs = split\_docs(documents) print(len(docs))

\*\*when I run python3 indexing.py Getting error

python3 indexing.py

/Users/sarit.bahuguna/ai\_chatbot/data/SwiftProgrammingLanguage.pdf

**\[nltk\_data\] Error loading punkt: <urlopen error \[Errno 60\] Operation**
