4 ms·
You missed the Output: No module named 'google' found below. If they cut out this nonsense: try: from google import search except ImportError:
by justinsaccount 9y ago
You missed the
Output:
No module named 'google' found
below.
If they cut out this nonsense:
try:
from google import search
except ImportError:
print("No module named 'google' found")
and just used
from google import search
One would have gotten a sane error message:
Traceback (most recent call last):
File "00359ada2bfcd6dbabd1fa0207e683b8.py", line 1, in <module>
from google import search
ImportError: No module named google
catching ImportError when you have no fallback is a pointless thing to do.
- happy-go-lucky 9y ago> You missed the Output: No module named 'google' found I didn't miss that. I knew it wouldn't work. Just gave it a try :)
- ehsankia 9y agoFirst thing that jumped at me when I was reading the code. Why would you wrap an import in a try catch unless you want to import something else when the first one fails. And if you don't, you should exit ones the import fails rather than let it continue and hit inevitable failure.
- philipov 9y agoMaybe it was written by programmers trained on compiled languages with no interpreter to automatically catch all exceptions and print a traceback for you, so now they're cargo culting onto "Every exception must get caught to avoid undefined behavior."