[Python] Issue with loading online pdf in python notebook using langchain PyPDFLoader

Discussão em 'Python' iniciado por Stack, Junho 18, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to load with python langchain library an online pdf from: http://datasheet.octopart.com/CL05B683KO5NNNC-Samsung-Electro-Mechanics-datasheet-136482222.pdf

    This is the code that I'm running locally:

    loader = PyPDFLoader(datasheet_path)
    pages = loader.load_and_split()


    Am getting the following error
    ---------------------------------------------------------------------------
    PermissionError Traceback (most recent call last)
    Cell In[4], line 8
    6 datasheet_path = "http://datasheet.octopart.com/CL05B683KO5NNNC-Samsung-Electro-Mechanics-datasheet-136482222.pdf"
    7 loader = PyPDFLoader(datasheet_path)
    ----> 8 pages = loader.load_and_split()
    11 query = """

    File ***\.venv\lib\site-packages\langchain\document_loaders\base.py:36, in BaseLoader.load_and_split(self, text_splitter)
    34 else:
    35 _text_splitter = text_splitter
    ---> 36 docs = self.load()
    37 return _text_splitter.split_documents(docs)
    ...
    (...)
    114 for i, page in enumerate(pdf_reader.pages)
    115 ]

    PermissionError: [Errno 13] Permission denied: 'C:\\Users\\****\\AppData\\Local\\Temp\\tmpu_59ngam'


    Note1: running the same code in google Colab works well Note2: running the following code in the same notebook is working correctly so I'm not sure access to the temp folder is problematic in any manner:

    with open('C:\\Users\\benis\\AppData\\Local\\Temp\\test.txt', 'w') as h:
    h.write("test")


    Note3: I have tested several different online pdf. got same error for all.

    The code should covert pdf to text and split to pages using Langchain and pyplot

    Continue reading...

Compartilhe esta Página