Share via

My python script failing without giving any error on Windows 11. Please help.

Anonymous
2024-06-25T07:44:33+00:00

Without any error on console, Python script is getting closed again and again. I checked windows 11 logs. Log Event ID is 1005 and Task Category is "Application Crashing Events".

Here is the detailed log message of the event-

Windows cannot access the file  for one of the following reasons: there is a problem with the network connection, the disk that the file is stored on, or the storage drivers installed on this computer; or the disk is missing. Windows closed the program Python because of this error.

Program: Python

File:

The error value is listed in the Additional Data section.

User Action

1. Open the file again. This situation might be a temporary problem that corrects itself when the program runs again.

2. If the file still cannot be accessed and

- It is on the network, your network administrator should verify that there is not a problem with the network and that the server can be contacted.

- It is on a removable disk, for example, a floppy disk or CD-ROM, verify that the disk is fully inserted into the computer.

3. Check and repair the file system by running CHKDSK. To run CHKDSK, click Start, click Run, type CMD, and then click OK. At the command prompt, type CHKDSK /F, and then press ENTER.

4. If the problem persists, restore the file from a backup copy.

5. Determine whether other files on the same disk can be opened. If not, the disk might be damaged. If it is a hard disk, contact your administrator or computer hardware vendor for further assistance.

Additional Data

Error value: 0x0

Disk type: 0x0

What should I do so that this issue stop happening?

Windows for home | Windows 11 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2024-06-25T11:53:31+00:00

    Hi, How are you? I am Alan, Microsoft Expert, an Independent Advisor. I will be happy to assist you today. I appreciate your contact!

    Let's resolve the issue of your Python script failing on Windows 11 without giving an error in the console. The log event indicates a file access problem, which can be caused by several reasons. Here are some steps to troubleshoot this issue:

    1.Check and Repair the File System:

    Open Command Prompt as administrator.

    Type the following command and press Enter: chkdsk /f

    The system may ask for a restart to perform the check. Allow the restart if necessary.

    2.Check File Permissions:

    Ensure the Python script and all necessary files have the correct permissions.

    Right-click the script file, go to "Properties", and check the permissions under the "Security" tab.

    3.Check and Update Storage Drivers:

    Press Win + X and select "Device Manager".

    Expand "Disk drives" and "IDE ATA/ATAPI controllers".

    Right-click each device and select "Update driver".

    Choose "Search automatically for updated driver software".

    4.Temporarily Disable Security Software:

    Some security software may interfere with script execution.

    Try temporarily disabling your antivirus or firewall and run the script again.

    5.Check the Script Code:

    Ensure the Python script is not trying to access files or network resources that might not be available.

    Add exception handling in the code to catch and log specific errors, for example:

    try:

    # your code here
    

    except Exception as e:

    print(f"Error: {e}")
    

    6.Run the Script in Safe Mode:

    Boot Windows in Safe Mode and try running the script to see if the issue persists.

    This can help identify if third-party software is causing the problem.

    7.Reinstall Python:

    If the problem continues, try reinstalling Python.

    Uninstall Python from your system via Settings > Apps.

    Download and install the latest version of Python from the official site (https://www.python.org/downloads/).

    These steps should help identify and fix the issue with your Python script. I hope this information helps. If you have any questions, please let me know and I'll be glad to assist you further.

    Best,

    Alan

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2024-06-28T16:40:13+00:00

    Hi Thank you for guiding. Reintsalling Python fixed the problem. Thank you very much..

    0 comments No comments