Python Forum
FileNotFoundError: [Errno 2] No such file or directory:
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FileNotFoundError: [Errno 2] No such file or directory:
#1
Hello, I have this FileNotFoundError and I need help

global data
headers = open("C:\\Users\\sazug\\OneDrive\\Desktop\\DDOS\\hammer\\headers\\headers.txt", "r")
data = headers.read()
headers.close
This DDoS project is just for educational purposes and I'm testing it on my own network
and also I want to learn more stuff about this project but this error doesn'tlet me so please help.



Error:
Traceback (most recent call last): File "Hammer.py", line 120, in <module> headers = open("C:\\Users\\sazug\\OneDrive\\Desktop\\DDOS\\hammer\\headers\\headers.txt", "r") FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\sazug\\OneDrive\\Desktop\\DDOS\\hammer\\headers\\headers.txt'
Thank You!
Reply
#2
check that file exists at that location
as a side note for code like this global data is not necessary. And using globals is generally discouraged.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Nov-02-2020, 12:24 PM)buran Wrote: check that file exists at that location
as a side note for code like this global data is not necessary. And using globals is generally discouraged.


the file exists in the directory but still doesn't work
Reply
#4
you cannot argue with the interpreter - if it says it's not there, then there is some problem that you cannot see
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
(Nov-02-2020, 12:36 PM)buran Wrote: you cannot argue with the interpreter - if it says it's not there, then there is some problem that you cannot see

Okay, I will check the whole code, Thanks for helping <3
Reply
#6
for example - it look suspicious you have a sub-folder Desktop inside folder OneDrive. Not that it's not possible that you have created such folder inside OneDrive folder, but still suspicious
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#7
(Nov-02-2020, 12:44 PM)buran Wrote: for example - it look suspicious you have a sub-folder Desktop inside folder OneDrive. Not that it's not possible that you have created such folder inside OneDrive folder, but still suspicious

It did it by itself
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error (Errno 2), File upload with the Flask framework and a public IP Username_Python1 0 263 Mar-28-2024, 01:46 PM
Last Post: Username_Python1
  FileNotFoundError: [WinError 2] The system cannot find the file specified NewBiee 2 1,571 Jul-31-2023, 11:42 AM
Last Post: deanhystad
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 3,333 Jun-27-2023, 01:17 PM
Last Post: diver999
  Extract file only (without a directory it is in) from ZIPIP tester_V 1 995 Jan-23-2023, 04:56 AM
Last Post: deanhystad
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,123 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  no such file or directory in SFTP saisankalpj 2 1,546 Nov-25-2022, 11:07 AM
Last Post: DeaD_EyE
Photo Making Zip file of a file and Directory Nasir 2 1,025 Oct-07-2022, 02:01 PM
Last Post: Nasir
  Failed to execute child process (No such file or directory) uriel 1 1,653 Sep-15-2022, 03:48 PM
Last Post: Gribouillis
  Need Help: FileNotFoundError:[Errno 2] No such file or directory python202209 5 2,645 Sep-12-2022, 04:50 AM
Last Post: python202209
  importing functions from a separate python file in a separate directory Scordomaniac 3 1,369 May-17-2022, 07:49 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020