Skip to content

Commit e1430cd

Browse files
Merge pull request #2833 from fudtastic/update-import-error-handling
Add library import error specificity and terminate
2 parents bc756ba + ff801ad commit e1430cd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Anime-Tracker/anime_tracker.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
try:
2+
import sys
23
import requests
34
from bs4 import BeautifulSoup
45
import urllib.parse as parse
56
import re
67
import argparse
78

8-
except ImportError:
9-
print('Some modules are not installed! ')
9+
except ImportError as e:
10+
print('Terminal Error! ')
11+
print(f'System module import error: {e}')
12+
sys.exit(1)
1013

1114
# mainly bs4 lib is used for extracting html from web pages
1215

0 commit comments

Comments
 (0)