0

I am using Django to display my code in an html format using class based views. My code reads a log file and displays stats based on what is in there. When I try to access the log file from my computer this error message is displayed:

[Errno 13] Permission denied: 'C:/Users/bhattaar/Downloads/access.log'

I first tried going through the properties of the folder to make sure everything was set to read only (which it already was) and then I tried running the command prompt as an administrator and it still would not work.

The line the error appears on is this: log = open('C:/Users/bhattaar/Downloads/access.log', 'r')

Does anyone know how I can resolve this issue?

1 Answers1

0

Does this work?

Taken from here

log_file = r'C:/Users/bhattaar/Downloads/access.log'

with open(log_file) as f:
    f = f.readlines()
André Krosby
  • 1,008
  • 7
  • 18