<code> File "E:app projectpythonpacagervenvlibsite-packagesxlsxwriterworkbook.py", line 354, in close
raise FileCreateError(e)
xlsxwriter.exceptions.FileCreateError: [Errno 2] No such file or directory: 'C:/Users/User/Documents/ClassRoutines.xlsx'
</code>
<code> File "E:app projectpythonpacagervenvlibsite-packagesxlsxwriterworkbook.py", line 354, in close
raise FileCreateError(e)
xlsxwriter.exceptions.FileCreateError: [Errno 2] No such file or directory: 'C:/Users/User/Documents/ClassRoutines.xlsx'
</code>
File "E:app projectpythonpacagervenvlibsite-packagesxlsxwriterworkbook.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
<code>from pathlib import Path
import xlsxwriter
</code>
<code>from pathlib import Path
import xlsxwriter
</code>
from pathlib import Path
import xlsxwriter
<code>documents_folder = Path.home() / 'Documents'
file_path = documents_folder / 'ClassRoutines.xlsx'
file_path_str = file_path.as_posix()
workbook = xlsxwriter.Workbook(file_path_str)
</code>
<code>documents_folder = Path.home() / 'Documents'
file_path = documents_folder / 'ClassRoutines.xlsx'
file_path_str = file_path.as_posix()
workbook = xlsxwriter.Workbook(file_path_str)
</code>
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
New contributor
Md Labib Alam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.