From f4bcc0a6d346cd95ccb42ef872169103d4f81fa7 Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Sun, 13 Sep 2026 16:32:15 -0400 Subject: [PATCH] feat: completed problem-05.py --- lab-02/problem-05.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lab-02/problem-05.py b/lab-02/problem-05.py index 6a6b72d..490bb34 100644 --- a/lab-02/problem-05.py +++ b/lab-02/problem-05.py @@ -1,6 +1,8 @@ # Write a Python program that opens a file and handles a PermissionError exception if there is a permission issue. - +# Try opening 'filename2.txt' (file created with 000 permissions as to trigger exception try: open('filename2.txt') +# Handle expected PermissionError exception except PermissionError: + # Print error message print('Insufficient file permissions')