Permission denied when opening .txt file with python I wrote a script that involves outputting some information to a .txt file.  A couple days ago this script worked just fine with no errors.  Since then I have changed nothing in the script but now when I run it in Blender I get the following error:

traceback (most recent call last):
  File "&lt;blender_console&gt;", line 1, in &lt;module&gt;
PermissionError: [Errno 13] Permission denied: 'input.txt'


With info from the various other Permission denied questions (here, here, here, and here) I have done some troubleshooting and gleaned the following information:


The file is not open anywhere else.
I can save the .blend file and open/import/export other files just fine, unlike the problems the above linked questions are addressing.
I have tried open('input.txt', 'w') from the command line within Blender and it throws the same error.
I have tried open('input.txt', 'r'), and open('input.txt', 'r+') as well, these throw [Errno 2] No such file or directory: 'input.txt', even though the file does in fact exist.
I can open and write to the exact same file from a python script outside of Blender just fine.  So the problem seems to be from within Blender.
This exact same script worked just fine a couple days ago, it has not been modified since.


Any idea what could have changed and caused Blender (and Blender only) to no longer be able to access this file?
I had the same problem today! I don't know if It's too late now, but this is my solution: insert the entire file-path for your file.
Example:
file = open(&quot;C:\\Users\\userName\\Desktop\\Codes\\f.txt&quot;,&quot;w&quot;)