[Florent Guillaume]
> I'm having a weird failure here using Zope 2.7.0 rc2 and python 2.3.3
> (Debian). When I execute a python script with the code:
>
>   foo = range(1.0)
>
> I get this:
>   Error Type:  TypeError
>   Error Value: unsubscriptable object
>   Traceback (innermost last):
>      * Module ZPublisher.Publish, line 104, in publish
>      * Module warnings, line 57, in warn
>      * Module warnings, line 63, in warn_explicit
> Instead of the expected:
>   DeprecationWarning: integer argument expected, got float
>
> I don't know if it's python's fault or Zope's... But I guess python
> assumes too much about something as it fails in its standard
> libraries.
>
> If i use the code
>    for i in range(1.0):
>       pass
> The traceback is a bit longer:
>
> Error Type:  TypeError
> Error Value: unsubscriptable object
> Traceback (innermost last):
>      * Module ZPublisher.Publish, line 100, in publish
>      * Module ZPublisher.mapply, line 88, in mapply
>      * Module ZPublisher.Publish, line 40, in call_object
>      * Module Shared.DC.Scripts.Bindings, line 306, in __call__
>      * Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
>      * Module Products.PythonScripts.PythonScript, line 318, in _exec
>      * Module None, line 1, in testbug
>        <PythonScript at /testbug>
>        Line 1
>      * Module AccessControl.ZopeGuards, line 210, in next
>      * Module warnings, line 57, in warn
>      * Module warnings, line 63, in warn_explicit
>
> TypeError: unsubscriptable object

Looks messy.  It's dying here (in Python's warnings.py):

def warn_explicit(message, category, filename, lineno,
                  module=None, registry=None):
    if module is None:
        module = filename
        if module[-3:].lower() == ".py":  ************ HERE *********

filename and module are both None at this point.  That can't happen when
running "real Python".

The globals set up for running the script appear not to contain a '__file__'
key, and have a '__name__' key explicitly set to None.  If it set either of
these to something useful, or didn't have a '__name__' key explicitly set to
None, warning.warn() would have been able to make up *something* for
warn_explicit's filename and/or module arguments.


_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to