Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Windows Server » Fix FileNotFoundError: [Errno 2] No such file or directory
  • BANNER
    How to Install and Set Lively Wallpaper on Windows 11 Windows
  • yxxycx yx
    How to change the Default First-Site-Name in Active Directory Windows Server
  • Screenshot 2020 10 31 at 10.35.37
    How to set the PowerShell Execution Policy via Windows Registry Windows Server
  • AWS import issues   OVA
    Error importing OVA file to AWS: Client error saved empty is empty AWS/Azure/OpenShift
  • image 35
    How to Activate and Press Ctrl+Alt+Del in Anydesk for Remote Access Connection to Windows system Windows
  • GNS3
    How to Connect GNS3 to the internet on Windows Network | Monitoring
  • S3 Bucket 1
    How to delete AWS S3 Bucket and Objects via  AWS CLI from Linux AWS/Azure/OpenShift
  • wacxx
    Install Windows Admin Center in an unattended mode using a self-signed certificate Windows

Fix FileNotFoundError: [Errno 2] No such file or directory

Posted on 12/10/202415/10/2024 Christian By Christian No Comments on Fix FileNotFoundError: [Errno 2] No such file or directory
FileNotFoundError-Errno 2-No such file or directory

In this article, you will learn how to fix FileNotFoundError: [Errno 2] No such file or directory. A FileNotFoundError occurs in Python when you try to access a file that doesn’t exist in the specified directory or path. Please see how to “Enable the Virtual Machine Platform Windows Feature and ensure Virtualization is enabled in the BIOS“, and how to Visualize MBAM Recovery Audit Report with Python.

Also, see how to detect who disabled a user in Active Directory. Here is a guide on “Task Scheduler shows task still running despite success“, and how to Query MBAM to display the BitLocker Recovery report.

Why was this error prompted?

As discussed above, the FileNotFoundError occurs in Python when you try to access a file that doesn’t exist in the specified directory or path.

Here is a related error ” Task Scheduler Errors and Success Codes: Status Code 0x41301“. Also, see how to fix Windows Task Scheduler 0x2 Error, and how to Fix Windows Task Scheduler Error 0x1.

task scheduler

Troubleshooting FileNotFoundError

Since we have discussed all possible error codes as shown above. We will proceed to troubleshooting from the Terminal. When you run the script from the terminal produces more errors.

PS C:\Users\xxxxx> & "C:/Program Files/Python/python.exe" c:/Scripts/PythonScripts/Devices-recovered.py
Traceback (most recent call last):
  File "c:\Scripts\PythonScripts\Devices-recovered.py", line 12, in <module>
    with open("//xxxx//MBAMReports//RecoveryAudit//Recovery Audit Report.csv", 'r') as file:
FileNotFoundError: [Errno 2] No such file or directory: '//xxx//MBAMReports//RecoveryAudit//Recovery Audit Report.csv'
PS C:\Users\xxxxx> & "C:/Program Files/Python/python.exe" c:/Scripts/PythonScripts/Devices-recovered.py
Traceback (most recent call last):
  File "c:\Scripts\PythonScripts\Devices-recovered.py", line 12, in <module>

Please see how to detect who disabled a user in Active Directory, and How to solve Errno 256. Also, see “how to fix you are not allowed to view this folder on SSRS: MBAM reports cannot be accessed because it could not load folder contents“.

Solution for No such file or directory

To do this, we will have to create a Subscription. Here is an article discussing similar steps “Email notifications for MBAM Enterprise and Compliance and Recovery Audit reports“.

I took a look over the file explorer to see if the “Recovery Audit Report.csv” was indeed present. It turned out it was deleted accidentally. Therefore, I will have to regenerate this file for the script to consume.

Open a web browser and navigate to SQL Server Reporting Services via URL: https://xxxxxxxxxxxx.com. In the example below, I will be configuring first for the “Recovery Audit Report”. Therefore, I will be clicking on the three horizontal dots (...)/ellipsis and select manage or subscribe.

impersonation error

Create or Edit the subscription and ensure you enter the account that will be used to access the file

windows credential

Now, I have decided to run the subscription to create the file in the right location instead of waiting for the scheduled task to do this.

Status-running

As you can see below, the creation was successful thereby eliminating the FileNotFoundError.

Successfully run

Now, the scheduled task should be able to run without errors and when the script is run from the terminal. The error message will not appear again as the file is now available.

I hope you found this post on “MBAM Reports: How to fix FileNotFoundError: [Errno 2] No such file or directory” very useful. Please feel free to leave a comment below.

5/5 - (1 vote)

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Pocket (Opens in new window) Pocket
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Scripts, Windows Server Tags:MBAM Reports, Microsoft Windows, Task Scheduler

Post navigation

Previous Post: How to determine Active Directory Site Name
Next Post: Configure Autologin for a VM in VMware Workstation

Related Posts

  • article 1280x720.166f8634
    How to install DHCP role on Windows Server 2019 Windows Server
  • Setup FSx File System 1
    Create and mount FSx File System: Join EC2 instance to AWS Managed AD AWS/Azure/OpenShift
  • rdp5
    Change expired RDP Password: How to change a password on a Remote Desktop session Windows Server
  • WSUS Analysis and Initial Assessment
    Preliminary Guide for WSUS Analysis and Initial Assessment Windows Server
  • VHDX resizing and veeam back
    Hyper V Disk allocation: Why Veeam reports full size after Shrinking Windows Server
  • schedulepythontasksinWindows
    Run Python Script via Windows Task Scheduler Windows

More Related Articles

article 1280x720.166f8634 How to install DHCP role on Windows Server 2019 Windows Server
Setup FSx File System 1 Create and mount FSx File System: Join EC2 instance to AWS Managed AD AWS/Azure/OpenShift
rdp5 Change expired RDP Password: How to change a password on a Remote Desktop session Windows Server
WSUS Analysis and Initial Assessment Preliminary Guide for WSUS Analysis and Initial Assessment Windows Server
VHDX resizing and veeam back Hyper V Disk allocation: Why Veeam reports full size after Shrinking Windows Server
schedulepythontasksinWindows Run Python Script via Windows Task Scheduler Windows

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • BANNER
    How to Install and Set Lively Wallpaper on Windows 11 Windows
  • yxxycx yx
    How to change the Default First-Site-Name in Active Directory Windows Server
  • Screenshot 2020 10 31 at 10.35.37
    How to set the PowerShell Execution Policy via Windows Registry Windows Server
  • AWS import issues   OVA
    Error importing OVA file to AWS: Client error saved empty is empty AWS/Azure/OpenShift
  • image 35
    How to Activate and Press Ctrl+Alt+Del in Anydesk for Remote Access Connection to Windows system Windows
  • GNS3
    How to Connect GNS3 to the internet on Windows Network | Monitoring
  • S3 Bucket 1
    How to delete AWS S3 Bucket and Objects via  AWS CLI from Linux AWS/Azure/OpenShift
  • wacxx
    Install Windows Admin Center in an unattended mode using a self-signed certificate Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,832 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.