Skip to content

Instantly share code, notes, and snippets.

@erikkaplun
Created August 1, 2012 09:58
Show Gist options
  • Save erikkaplun/3225561 to your computer and use it in GitHub Desktop.
Save erikkaplun/3225561 to your computer and use it in GitHub Desktop.
import with SyntaxError
print "importing problematic_module through other_module:"
try:
import other_module
except Exception as e:
print "...got", e
print "importing problematic_module directly:"
try:
import problematic_module
except Exception as e:
print "...got", e
import problematic_module
~/work/tmp/importtest$ python main.py
importing problematic_module through other_module:
...got invalid syntax (problematic_module.py, line 1)
importing problematic_module directly:
...got invalid syntax (problematic_module.py, line 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment