On Oct 29, 2:19 pm, reco <r...@nex9.com> wrote:

>   File "lib/setuptools-0.6c11-py2.5.egg/pkg_resources.py", line 24, in
> <module>
>     from os import utime, rename, unlink, mkdir
> ImportError: cannot import name mkdir
> INFO     2009-10-29 19:56:30,793 dev_appser

Actually, the latest setuptools is what changed. There didn't used to
be a specific import of mkdir.

I solved it in my app.py by setting os.mkdir to a value before
importing anything else. Hackish, but it works fine. This leaves you
open to breakage from something else the next time you upgrade any
third-party deps, of course. But an attempt to preemptively handle all
such errors would itself be prone to breakage if the supported set of
modules/functions changed in the future, so it's probably better just
to spread the idea of setting such functions equal to a value before
other imports that use them.

As for what will raise errors, the GAE Python runtime docs make the oh-
so-helpful statement that "the os module is available, but with
unsupported features disabled," without mentioning exact function
names. I generated a list, though, and it's pretty long. Another issue
is that while some will raise ImportError/AttributeError (e.g.
os.mkdir), others will import fine but not work (tempfile.mkstemp).

Has anyone published a list of standard library functions that result
in ImportError/AttributeError when accessed under GAE?  Otherwise, I
might create an automated process for locating them dynamically, for,
eh, fun or something.

Jason

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to