'Not sure why I'm getting this indentation error. "expected an indented block after 'with' statement on line 6"
So when I try to run this code, I keep getting an indentation error on line 7. It says "expected an indented block after 'with' statement on line 6" and then highlights a blank space on line 7 after the "FileNotFoundError:" in red. I've tried messing with the indentation to see what could fix it but I can't get any results.
with open("ErrorLog.rtf","r")as f_obj:
lines = f_obj.readlines()
for line in lines:
print(line.rstrip())
try:
with open("ErrorLog.rtf","r")as f_obj:
except FileNotFoundError:
print(f_name "not found")
else:
for line in lines:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
