On Fri, 13 Jul 2007 14:37:57 +0100, Greg Bowyer <[EMAIL PROTECTED]> wrote:
>Sorry if this is an exceptional newbie post ...
>
>Now that pypy has hit v1 I have tried using it for a few test examples,
>most of this stuff so far is a little bit simple, however one test is to
>run a django application that I am developing for someone with pypy
>rather that cpython
>
>However when I fire up pypy i get the following from the django
>application, what am I missing here
>
>[EMAIL PROTECTED] ~/projects/minesite/minesite $ ./pypy-c manage.py runserver
>debug: WARNING: library path not found, using compiled-in sys.path
>Traceback (most recent call last):
>   File "?", line 32, in run_toplevel
>   File "manage.py", line 11, in <module>
>     execute_manager(settings)
>   File "/usr/lib/python2.4/site-packages/django/core/management.py",
>line 1736, in execute_manager
>     execute_from_command_line(action_mapping, argv)
>   File "/usr/lib/python2.4/site-packages/django/core/management.py",
>line 1626, in execute_from_command_line
>     translation.activate('en-us')
>   File
>"/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py",
>line 66, in activate
>     return real_activate(language)
>   File
>"/usr/lib/python2.4/site-packages/django/utils/translation/__init__.py",
>line 29, in delayed_loader
>     from django.conf import settings
>   File "/usr/lib/python2.4/site-packages/django/conf/__init__.py", line
>149, in <module>
>     __builtins__['_'] = first_time_gettext
>TypeError: cannot set items on object

It seems likely that what django ought to be doing is:

    import __builtin__
    __builtin__._ = first_time_gettext

And a similar change in first_time_gettext.  __builtin__/__builtins__ is
a bit subtle and I might be forgetting something, but I think the above
is correct.  I remember that __builtins__ is somethings a dict instead of
the __builtin__ module, but I forget when (and I couldn't find the case
with a few simple tests).  I think python-dev has pointed out that this
is an implementation detail of CPython on several occassions, though, and
that explicitly importing the __builtin__ module is the right thing to
do.

Jean-Paul
_______________________________________________
pypy-dev@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to