Just a shot, from Modules/datetimemodule.c (I'm not an expert on this)

/* I sure don't want to reproduce the strftime code from the time
module,
 * so this imports the module and calls it.  All the hair is due to
 * giving special meanings to the %z, %Z and %f format codes via a
 * preprocessing step on the format string.
 * tzinfoarg is the argument to pass to the object's tzinfo method, if
 * needed. */

...and the offending code:

 PyObject *time = PyImport_ImportModuleNoBlock("time");

I wonder if any other modules have imports like this that would break
on the lack of import in __builtins__

On Apr 3, 1:43 am, Anand Chitipothu <[email protected]> wrote:
> I nailed down the problem to this.
>
> env = {'__builtins__': {}, "date": datetime.datetime.utcnow()}
> code = "date.strftime('%m %Y')"
> exec code in env
>
> Running this gives the following error.
> ...
>     exec code in env
>   File "<string>", line 1, in <module>
> KeyError: '__import__'
>
> Any python experts around for help?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to