Python Forum

Full Version: FileNotFoundError: [Errno 2] No such file or directory:
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!
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.
(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
you cannot argue with the interpreter - if it says it's not there, then there is some problem that you cannot see
(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
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
(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