Let me re-write the code to remove the confusion between command-line and interpreter modes.
import datetime now = datetime.datetime.utcnow() __builtins__ = {} print now.strftime("%m %Y") Why should this fail? I did some hack to see who is calling import. import datetime now = datetime.datetime.utcnow() def ximport(*a, **kw): print a, kw raise Exception __builtins__ = {'__import__': ximport} f = now.strftime print f("%m %Y") It fails when f is called. Traceback (most recent call last): File "x.py", line 11, in <module> print f("%m %Y") File "x.py", line 7, in ximport raise Exception Exception Any clues? _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers