google app engine - How do I find out whether a Python module is run on GAE? -



google app engine - How do I find out whether a Python module is run on GAE? -

i have module uses lxml. since cannot imported on gae, i'd utilize suitable substitute default. along lines of:

if not on_gae: import lxml else: import beautifulsoup

how can determine i'm on gae? there os variable of sorts?

update: there modules not run on gae (like sockets). rather having multiple blocks of try ... except importerror, i'd know start code blocks needs alternative implementation.

you can utilize this:

on_app_engine = os.environ.get('server_software', '').startswith('google')

then like:

if on_app_engine: import lxml else: import bla

python google-app-engine

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -