1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] xlsxwriter path not found, the path works in windows explorer

Discussão em 'Python' iniciado por Stack, Setembro 12, 2024.

  1. Stack

    Stack Membro Participativo

    File "E:\app project\python\pacager\venv\lib\site-packages\xlsxwriter\workbook.py", line 354, in close
    raise FileCreateError(e)
    xlsxwriter.exceptions.FileCreateError: [Errno 2] No such file or directory: 'C:/Users/User/Documents/ClassRoutines.xlsx'


    error is shown

    from pathlib import Path
    import xlsxwriter


    documents_folder = Path.home() / 'Documents'
    file_path = documents_folder / 'ClassRoutines.xlsx'
    file_path_str = file_path.as_posix()
    workbook = xlsxwriter.Workbook(file_path_str)


    path generated: C:/Users/User/Documents/ClassRoutines.xlsx

    Error: xlsxwriter.exceptions.FileCreateError: \[Errno 2\] No such file or directory: 'C:/Users/User/Documents/ClassRoutines.xlsx'

    'C:/Users/User/Documents/' exists so ClassRoutines.xlsx should have been created

    Continue reading...

Compartilhe esta Página