[Python] A code that is working on a jupyter notebook but not on a python file after a copy...

Discussão em 'Python' iniciado por Stack, Março 12, 2025.

  1. Stack

    Stack Membro Participativo

    I have a code that works fine in an .ipynb but when I copy/paste it on a .py file, in the exact same folder, it does not find a dependent file.

    The code line that is giving me an error of file not found, is this one.

    excel_file_path = "Excel_file.xlsx"

    dataframe = pd.read_excel(excel_file_path, sheet_name = "sheet_23")


    It runs fine in the jupyter notebook, but it gives me the following in the .py file.

    " FileNotFoundError: [Errno 2] No such file or directory: 'Excel_file.xlsx' "

    Thanks for the help.

    Continue reading...

Compartilhe esta Página