May-10-2020, 12:18 AM
Hi everyone, first of all, sorry if my english is quite poor.
I'm new into programming and python, and today, I found my first newbie problem that I can't solve, even after I googled it a lot.
I'm trying to create a text file that doesn´t exist in the working directory, with this:
FileNotFoundError: [Errno 2] No such file or directory: 'file.txt'
I understood that, if I use that code, the program will open the file, and if it doesn't exists, it will create it.
I've tried a lot of things, like reinstalling VS Code, Python, checked the paths, checked the directory permissions, but nothing works, and I can't find the solution.
Thank you in advance!
I'm new into programming and python, and today, I found my first newbie problem that I can't solve, even after I googled it a lot.
I'm trying to create a text file that doesn´t exist in the working directory, with this:
file = open('file.txt', 'w')Or with this one:
file = open('file.txt', 'w+')In every case I get the same error:
FileNotFoundError: [Errno 2] No such file or directory: 'file.txt'
I understood that, if I use that code, the program will open the file, and if it doesn't exists, it will create it.
I've tried a lot of things, like reinstalling VS Code, Python, checked the paths, checked the directory permissions, but nothing works, and I can't find the solution.
Thank you in advance!