[Answer]-File reading Error in django

1👍

Well, that code is clearly wrong. As the error says, you’re taking the string "r", and using the dot notation to call a path_to_file attribute on it, which doesn’t exist.

I’m not sure what that r is supposed to be doing at all. It should work fine without it:

fileanme = open(path_to_file , "rb")

Leave a comment