Python crashed. Process finished with exit code -1073741819 (0xC0000005)

  Kiến thức lập trình

I am using Python to convert CSV files to xlsx files. It works well when I am dealing with smaller files, but when I am dealing with larger files, it will prompt “1073741819 (0xC000000 5)”

I have tried different versions of Python and different libraries, but all have the same results. I tried using a VM virtual machine to create a new system to run the code, but the problem persisted.
At the same time, I also noticed a Python crash warning in the system log. Every time I receive “1073741819 (0xC000000 5)”, I can see an error message in the system log

Wrong application name: pythn.exe, version: 3.12.3150.1013, timestamp: 0x66154bab
Error module name: python312.dll, version: 3.12.3150.1013, timestamp: 0x66154b63
Exception code: 0xc000005
Error offset: 0x000000000037886
Error process ID: 0x894
Error application startup time: 0x01daa7b22147afbc
Error application path: C:  Users  Lee  AppData  Local  Programs  Python  Python312  pythonxe
Error module path: C:  Users  Lee  AppData  Local  Programs  Python  Python312  python312.dll
Report ID: 5cadb8e6-9e14-441f-a060-138a0723a53f
Error package full name:
Error package relative to application ID:

It’s strange that I’m running the same code on my laptop, it works well, and there’s no problem with the large files, so I’m starting to suspect that my device might be malfunctioning, and I’m confused. I’m using I9-13900K and DDR5. I don’t know if anyone here can help me,

This is my code

import csv
from openpyxl import Workbook

def csv_to_xlsx(csv_file, xlsx_file):

    wb = Workbook()
    ws = wb.active
    ws.title = "Sheet1"

    with open(csv_file, 'r', newline='', encoding='utf-8') as file:
        reader = csv.reader(file)
        ws.append(next(reader)) 

        for row in reader:
            ws.append(row)
    wb.save(xlsx_file)
csv_file_path = 'F:\1.csv'  
xlsx_file_path = 'F:\data.xlsx'  
csv_to_xlsx(csv_file_path, xlsx_file_path)

LEAVE A COMMENT