미해결
[2024 개정판] 이것이 진짜 크롤링이다 - 실전편 (인공지능 수익화)
lxml.etree.LxmlSyntaxError: not in an element - 쿠팡결과_엑셀저장
워크시트 저장하는 코드에서...lxml.etree.LxmlSyntaxError: not in an element이런 에러가 났습니다. 디렉토리명을 포함한 파일이름을 아래와 같이 했을 때...wb.save('./04_쿠팡_크롤링/coupang_result.xlsx')이것도 에러 납니다. wb.save('startCoding_crawling/04_쿠팡_크롤링/coupang_result.xlsx')이렇게 하니 에러가 나지 않았습니다. 참고 바랍니다. 오류 전체 내용은 다음과 같습니다.Traceback (most recent call last):
File "d:\python_Workspace\crawling\startCoding_crawling\04_쿠팡_크롤링\04_엑셀에저장하기.py", line 80, in <module>
wb.save('04_쿠팡_크롤링/coupang_result.xlsx') # 왜 2번쓰지?
File "d:\python_Workspace\crawling\lib\site-packages\openpyxl\workbook\workbook.py", line 386, in save
save_workbook(self, filename)
File "d:\python_Workspace\crawling\lib\site-packages\openpyxl\writer\excel.py", line 291, in save_workbook
archive = ZipFile(filename, 'w', ZIP_DEFLATED, allowZip64=True)
File "C:\Users\exper\Anaconda3\lib\zipfile.py", line 1248, in __init__
self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: '04_쿠팡_크롤링/coupang_result.xlsx'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "d:\python_Workspace\crawling\lib\site-packages\openpyxl\worksheet\_writer.py", line 32, in _openpyxl_shutdown
os.remove(path)
PermissionError: [WinError 32] 다른 프로세스가 파일을 사용 중이기 때문에 프로세스가 액세스 할 수 없습니다:
'C:\\Users\\exper\\AppData\\Local\\Temp\\openpyxl.9zt9hqlf'
Exception ignored in: <generator object WorksheetWriter.get_stream at 0x0000019973439F90>
Traceback (most recent call last):
File "d:\python_Workspace\crawling\lib\site-packages\openpyxl\worksheet\_writer.py", line 300, in get_stream
File "src\lxml\serializer.pxi", line 1834, in lxml.etree._FileWriterElement.__exit__
File "src\lxml\serializer.pxi", line 1570, in lxml.etree._IncrementalFileWriter._write_end_element
lxml.etree.LxmlSyntaxError: inconsistent exit action in context manager
Exception ignored in: <generator object WriteOnlyWorksheet._write_rows at 0x00000199734B05F0>
Traceback (most recent call last):
File "d:\python_Workspace\crawling\lib\site-packages\openpyxl\worksheet\_write_only.py", line 75, in _write_rows
File "src\lxml\serializer.pxi", line 1834, in lxml.etree._FileWriterElement.__exit__
File "src\lxml\serializer.pxi", line 1568, in lxml.etree._IncrementalFileWriter._write_end_element
lxml.etree.LxmlSyntaxError: not in an element