#16607: NameError for built-in Python functions in Django when working with 
uWSGI
-----------------------------------------+------------------------------
               Reporter:  hust.zcheng@…  |          Owner:  nobody
                   Type:  Bug            |         Status:  closed
              Milestone:                 |      Component:  Core (Other)
                Version:  1.3            |       Severity:  Normal
             Resolution:  needsinfo      |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------------
Changes (by jezdez):

 * status:  new => closed
 * resolution:   => needsinfo


Old description:

> I'm running Django 1.3 on Ubuntu 10.10 (64bit) with uWSGI (0.9.8).
> However, occasionally I can find such logs in uwsgi.log, reporting that
> 'getattr', 'isinstance' is not defined. But aren't they Python's built-in
> functions? Why Django unable to find them? The heavier the traffic is,
> the more likely this will happend.
>
> I'm sure that there is nothing wrong with my application, but I'm not
> sure if this is a bug in Django or uWSGI. Can anyone give me a help?
>
> Detail log:
> Error in sys.excepthook:
> Traceback (most recent call last):
>   File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 48,
> in apport_excepthook
>     if not enabled():
>   File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 24,
> in enabled
>     return re.search('^\s*enabled\s*=\s*0\s*$', conf, re.M) is None
>   File "/usr/lib/python2.6/re.py", line 142, in search
>     return _compile(pattern, flags).search(string)
>   File "/usr/lib/python2.6/re.py", line 236, in _compile
>     if isinstance(pattern, _pattern_type):
> NameError: global name ''''isinstance'''' is not defined
>
> Original exception was:
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.6/dist-
> packages/django/core/handlers/wsgi.py", line 258, in __call__
>     set_script_prefix(base.get_script_name(environ))
>   File "/usr/local/lib/python2.6/dist-
> packages/django/core/handlers/base.py", line 239, in get_script_name
>     if settings.FORCE_SCRIPT_NAME is not None:
>   File "/usr/local/lib/python2.6/dist-
> packages/django/utils/functional.py", line 277, in __getattr__
>     return getattr(self._wrapped, name)
> NameError: global name 'getattr' is not defined
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.6/dist-
> packages/django/core/handlers/wsgi.py", line 258, in __call__
>     set_script_prefix(base.get_script_name(environ))
>   File "/usr/local/lib/python2.6/dist-
> packages/django/core/handlers/base.py", line 252, in get_script_name
>     return force_unicode(environ.get('SCRIPT_NAME', u''))
>   File "/usr/local/lib/python2.6/dist-packages/django/utils/encoding.py",
> line 64, in force_unicode
>     if isinstance(s, unicode):
> NameError: global name ''''isinstance'''' is not defined
> Error in sys.excepthook:
> Traceback (most recent call last):
>   File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 48,
> in apport_excepthook
>     if not enabled():
>   File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 24,
> in enabled
>     return re.search('^\s*enabled\s*=\s*0\s*$', conf, re.M) is None
>   File "/usr/lib/python2.6/re.py", line 142, in search
>     return _compile(pattern, flags).search(string)
>   File "/usr/lib/python2.6/re.py", line 236, in _compile
>     if isinstance(pattern, _pattern_type):
> NameError: global name ''''isinstance'''' is not defined

New description:

 I'm running Django 1.3 on Ubuntu 10.10 (64bit) with uWSGI (0.9.8).
 However, occasionally I can find such logs in uwsgi.log, reporting that
 'getattr', 'isinstance' is not defined. But aren't they Python's built-in
 functions? Why Django unable to find them? The heavier the traffic is, the
 more likely this will happend.

 I'm sure that there is nothing wrong with my application, but I'm not sure
 if this is a bug in Django or uWSGI. Can anyone give me a help?

 Detail log:
 {{{
 Error in sys.excepthook:
 Traceback (most recent call last):
   File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 48,
 in apport_excepthook
     if not enabled():
   File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 24,
 in enabled
     return re.search('^\s*enabled\s*=\s*0\s*$', conf, re.M) is None
   File "/usr/lib/python2.6/re.py", line 142, in search
     return _compile(pattern, flags).search(string)
   File "/usr/lib/python2.6/re.py", line 236, in _compile
     if isinstance(pattern, _pattern_type):
 NameError: global name ''''isinstance'''' is not defined

 Original exception was:
 Traceback (most recent call last):
   File "/usr/local/lib/python2.6/dist-
 packages/django/core/handlers/wsgi.py", line 258, in __call__
     set_script_prefix(base.get_script_name(environ))
   File "/usr/local/lib/python2.6/dist-
 packages/django/core/handlers/base.py", line 239, in get_script_name
     if settings.FORCE_SCRIPT_NAME is not None:
   File "/usr/local/lib/python2.6/dist-
 packages/django/utils/functional.py", line 277, in __getattr__
     return getattr(self._wrapped, name)
 NameError: global name 'getattr' is not defined
 Traceback (most recent call last):
   File "/usr/local/lib/python2.6/dist-
 packages/django/core/handlers/wsgi.py", line 258, in __call__
     set_script_prefix(base.get_script_name(environ))
   File "/usr/local/lib/python2.6/dist-
 packages/django/core/handlers/base.py", line 252, in get_script_name
     return force_unicode(environ.get('SCRIPT_NAME', u''))
   File "/usr/local/lib/python2.6/dist-packages/django/utils/encoding.py",
 line 64, in force_unicode
     if isinstance(s, unicode):
 NameError: global name ''''isinstance'''' is not defined
 Error in sys.excepthook:
 Traceback (most recent call last):
   File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 48,
 in apport_excepthook
     if not enabled():
   File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 24,
 in enabled
     return re.search('^\s*enabled\s*=\s*0\s*$', conf, re.M) is None
   File "/usr/lib/python2.6/re.py", line 142, in search
     return _compile(pattern, flags).search(string)
   File "/usr/lib/python2.6/re.py", line 236, in _compile
     if isinstance(pattern, _pattern_type):
 NameError: global name ''''isinstance'''' is not defined
 }}}

--

Comment:

 This needs a bit more information to ascertain the reasons for the
 `NameError`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16607#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

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

Reply via email to