Forums

I cannot edit my wsgi.py file

I have a project in /var/www directory, and when I edit my wsgi.py file and i exit, the file is no longer editable and turns black.

I tried to download the files and delete the project, and then upload the files again, but when i edit the wsgi.py file again and i exit from it, happens again.

What should I do?

What are you using to edit it? The in-browser editor, or something like vim or emacs?

When i try to access to the file in the dashboard(web) it shows me an error message:

"You do not have the permissions to edit /var/www/albertomj_pythonanywhere_com_wsgi.py."

i verified the permissions of the file through console and i've permissions to read it and to write it.

The only way i can edit the file is using nano through console.

I'm using the in-browser editor.

Can I take a look at the file? (I can see it from my side, but we always ask permission.)

Sure.

(Just as some background -- looking at the code for our in-browser editor, it looks like it could be confused about the editability of the file -- there's a bug where that message "you do not have the permissions" can appear in certain circumstances that aren't anything to do with permissions.)

OK, thanks -- checking it now.

OK, the problem is the bug I thought it was. Your WSGI file has a zero byte in it (inside a comment at line 80), so the in-browser editor is mis-interpreting it as a binary file and giving the wrong error message.

If you edit the file in nano and remove the zero byte (which will probably show up as ^A) then it should be editable in the in-browser editor again.

I'll make sure the bug in the error reporting is logged for fixing, we should at least display something more useful like "XXX is a binary file and I don't know how to edit it" when you click on a link for a file like that.

i changed it and works! Thank you

No problem -- thanks for confirming!