Python Forum
Index out of range error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Index out of range error
#1
I am trying to simply load a pdf doc and use langchain to process so I could query it with ChatGPT. I cannot get past loading the pdf doc. Cannot figure out what I am doing wrong here. Tried this code hoping and expecting to get the text on the first page just to see if it is loading, but I get "index out of range" erro.

import langchain
import pypdf
from langchain.document_loaders import PyPDFLoader

PDFLoader= PyPDFLoader("RegexSplitTest.pdf")
pages = PDFLoader.load_and_split()
pages[0] 
Error:
IndexError Traceback (most recent call last) Cell In[34], line 7 5 PDFLoader= PyPDFLoader("RegexSplitTest.pdf") 6 pages = PDFLoader.load_and_split() ----> 7 pages[0] IndexError: list index out of range
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Getting Index Error - list index out of range krishna 2 2,604 Jan-09-2021, 08:29 AM
Last Post: buran
  Cycle through Numpy range within another range(?) Zero01 0 2,015 Jul-31-2020, 02:37 PM
Last Post: Zero01
  Getting Index Error - list index out of range RahulSingh 2 6,144 Feb-03-2020, 07:17 AM
Last Post: RahulSingh
  pandas.read_sas with chunksize: IndexError list index out of range axelle 0 2,578 Jan-28-2020, 09:30 AM
Last Post: axelle
  iterate over index and define each range as a day karlito 7 4,383 Nov-19-2019, 06:37 AM
Last Post: karlito
  Unable to identify Tuple index error appmkl 4 4,683 Jun-28-2019, 10:12 AM
Last Post: appmkl
  Can you help me with this error? IndexError: invalid index of a 0-dim tensor. DerBerliner 1 4,172 Feb-28-2019, 05:47 PM
Last Post: Larz60+
  Using pandas, index error fyec 1 4,675 Aug-01-2018, 09:25 AM
Last Post: volcano63
  OverflowError: math range error Nick_helps 4 13,590 Jul-29-2018, 11:29 AM
Last Post: wavic
  Regarding index out of bounds error and implementing Loop error in backpropagation al geevaprasa 6 8,560 Apr-20-2018, 09:35 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020