Forums

File Permission Bug

Hello!

I'm having a situation with two html files where I'm iterating over an object list, on the pythonanywhere file explorer won't let me edit those files and if I try to visit the direct link to edit it:

https://www.pythonanywhere.com/user/evaldez89/files/home/evaldez89/project_folder/template_folder/the_file.html?edit

it shows the: You do not have the permissions to edit "the file" error.

I was reading a topic where someone explained that not always it about permision, that it may be some bug on the code that the IDE is miss interpreting.

Indeed it was, but the problem is that I have removed line by line to find the bug and the line I removed that allowed me to have access to my file again is the line where I iterate over the object list I want the info from (in both files happens the same). Ex: This is my code:

{% for person in people_list.list %}
    here I create a tbody tag and then the rows with each person info
{% endfor %}

I try replacing the 'people_list.list' for just 'people_list' but no luck, the only way I can have the permission to edit the file is if I remove the {% for %}{%endfor%} tags.

Any help will be appreciated.

How are you editing the file without the editor? An editor in a Bash console? In that case, are you sure that you are editing the correct file? Also, you can view the file using the "Download" button to make sure that it's what you think it is.

Forgot to mention that part. I download the file and then edit it on my laptop, after that I upload it with the changes. Then, if I upload it without the iteration over the object lits that I mentioned, it allows me to edit the file other wise it shows the file grayed out.

Is it possible that there are some non-unicode characters in the file? That might trigger the problem you're seeing.

(If you don't know how to check for non-unicode characters, just let me know the path to the file and I can look for you.)

Thanks for the reply.

Sure the path is: /files/home/evaldez89/ConsolidacionService/consolidacion/templates

and the files: creyente_agrupado.html creyente_list.html

Yup, there are some non-unicode characters in both of those files.

To see them for yourself, you can run this command in bash, and look for black-on-white characters like this: ^?.

less /home/evaldez89/ConsolidacionService/consolidacion/templates/creyente_list.html

Excelent!

I found the unicode characters, removed them and now I have access to the files!

Thanks so much for the assistance!

I wonder: how those characters got in there and Is there a way to prevent this?

It is strange, yes. What are you using to edit them on your laptop?

PyCharm the comunity version

Hmm, I wouldn't expect that to cause any problems.

Well, thanks so much anyway you were very helpful

No problem! Let us know if it happens again, perhaps between us we'll be able to work out the cause.