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 "<blender_console>", line 1, in <module>
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?

  • 1
    $\begingroup$ Were you possibly running Blender with administrator privileges before and not now? Did you reinstall or update Blender or somehow change the executable in the meantime? Are there any security software running, like firewalls or antivirus that could have been triggered by said change? Are there any non ASCII characters anywhere in the filepath? $\endgroup$ Commented Dec 13, 2017 at 19:09
  • 1
    $\begingroup$ @DuarteFarrajotaRamos I don't know why it didn't occur to me to try running as administrator but I tried that and it worked. However now it baffles me as to why it worked initially as I definitely did not explicitly run as admin then. $\endgroup$
    – PGmath
    Commented Dec 13, 2017 at 21:28
  • $\begingroup$ And why would windows require Blender to be elevated to run the code but not IDLE? $\endgroup$
    – PGmath
    Commented Dec 13, 2017 at 21:31
  • 2
    $\begingroup$ Sounds like a file ownership issue; either the file itself, or the directory it's in. $\endgroup$ Commented Dec 13, 2017 at 22:29
  • $\begingroup$ @PGmath i think it is as Doyousketch2 pointed out where permissions have changed in the directory you try to save in, and then running as admin gives you those root privileges so that's why it will definitely work. Anti-virus or Security Software can also block access as Duarte pointed out. btw I checked your About section on profile and wanted to see your stuff on Blender Artist, but it's not there $\endgroup$
    – Harry McKenzie
    Commented Aug 19, 2023 at 4:06

1 Answer 1


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.


file = open("C:\\Users\\userName\\Desktop\\Codes\\f.txt","w")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .