2009/4/3 Anand Chitipothu <anandol...@gmail.com>: > I'm noticed a strange Import error in some web.py template. I nailed > down the problem to the following python code. > > __builtins__ = {} > > import datetime > now = datetime.datetime.utcnow() > print now.strftime("%m %Y") > > It fails with the following error. > > Traceback (most recent call last): > File "foo.py", line 6, in <module> > print now.strftime("%m %Y") > KeyError: '__import__' > > Any experts around for explaining this behavior?
Another strange behavior: when run as script, it fails at the last line and when run tried in interpreter, it fails at the import. _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers