Hi all,

Is there any standard way to tell if the user is running from a module
or from an interactive shell like IDLE or IPython? The best I've come
up with so far is for a function to look at
getouterframes(currentframe())[1][1] (the filename in the frame record
of the frame that called the function), and check if it exists or not
with os.path.exists. IPython gives '(ipython console)' and IDLE gives
'pyshell#0' whereas running from a module gives its filename. This
seems a bit hacky. Any better ideas?

--
Dan Goodman
http://thesamovar.net/contact
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to