What I want to do is patch an existing python module that uses urllib2 to run on app engine, but I don't want to break it so it can be used elsewhere. So I'm looking for a quick solution to test if the module is imported in the app engine environment or not. Catching ImportError on urllib2 might not be the best solution.
From stackoverflow
-
You could simply use sys.modules to test if a module has been imported (I'm using unicodedata as an example):
>>> import sys >>> 'unicodedata' in sys.modules False >>> import unicodedata >>> 'unicodedata' in sys.modules True
0 comments:
Post a Comment