[Zope] Verrryy strange behavior (NameError)

Andrew Athan aathan-zope-list%REMOVEME@memeplex.com
Fri, 6 Apr 2001 15:21:23 -0400


This is a multi-part message in MIME format.

------=_NextPart_000_00EB_01C0BEAD.3D5B30E0
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: 7bit


I'm getting an intermittent NameError trying to access a variable set in the
external scope of LoginManager.py .  I call my variable _x and set it
directly above where _LogginInUser gets set.  I then try to access it
directly above a line that accesses _LoggingInUser gets accessed.  I just do
a simple print 'testing=%s'%_x.  I get an exception.  The line that accesses
_LoggingInUser doesn't.

What gives?


Now get this ... if I change the name to (13x's) _xxxxxxxxxxxxx , it works.

If I then change the name to (6x's) _xxxxxx, it continues to work.

If I then change the name to (3x's) _xxx, it continues to work.
(2x's) _xx works
(1x's) _x doesn't work!!!!

If I change the line near the top of the file from
_xx='sss'
to
_xx=0
and change the print to use a %d  I get the NameError.

If I change the line back to _xx='sss' and the print back to a %s I continue
to get the NameError ... even though that exact combination had worked a
minute before!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If I then change the variable back to have 13x's it starts working again.
Is there some deep problem with the python byte compiler or access control
mangling features of Zope?  Or am I missing something stupid?

What in the world is going on?
A.

Traceback (innermost last):
  File D:\CloakMail\lib\python\ZPublisher\Publish.py, line 238, in
publish_module
  File D:\CloakMail\lib\python\ZPublisher\Publish.py, line 199, in publish
  File D:\CLOAKM~1\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
    (Object: Traversable)
  File D:\CloakMail\lib\python\ZPublisher\Publish.py, line 165, in publish
  File D:\CloakMail\lib\python\ZPublisher\BaseRequest.py, line 450, in
traverse
  File D:\CloakMail\lib\python\Products\LoginManager\LoginManager.py, line
236, in validate
    (Object: ProviderContainer)
NameError: (see above)





------=_NextPart_000_00EB_01C0BEAD.3D5B30E0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>I'm =
getting an=20
intermittent NameError trying to access a variable set in the external =
scope of=20
LoginManager.py .&nbsp; I call my variable _x and set it directly above =
where=20
_LogginInUser gets set.&nbsp; I then try to access it directly above a =
line that=20
accesses _LoggingInUser gets accessed.&nbsp; I just do a =
simple&nbsp;print=20
'testing=3D%s'%_x.&nbsp; I get an exception.&nbsp; The line that =
accesses=20
_LoggingInUser doesn't.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>What=20
gives?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>Now =
get this ... if=20
I change the name to (13x's)&nbsp;_xxxxxxxxxxxxx , it =
works.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>If I =
then change the=20
name to (6x's) _xxxxxx, it continues to work.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>If I =
then change the=20
name to (3x's) _xxx, it continues to work.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>(2x's) =
_xx=20
works</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>(1x's) =
_x doesn't=20
work!!!!</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>If I =
change the line=20
near the top of the file from</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001>_xx=3D'sss'</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001>to</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001>_xx=3D0</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>and =
change the print=20
to use a %d&nbsp; </SPAN></FONT><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001>I get the NameError.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>If I =
change the line=20
back to _xx=3D'sss' and the print back to a %s I continue to get the =
NameError ...=20
even though that exact combination had worked a minute=20
before!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>If I =
then change the=20
variable back to have 13x's it starts working again.&nbsp; Is there some =
deep=20
problem with the python byte compiler or access control mangling =
features of=20
Zope?&nbsp; Or am I missing something stupid?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D230302904-06042001>What =
in the world is=20
going on?</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001>A.</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><SPAN class=3D230302904-06042001>Traceback =
(innermost=20
last):<BR>&nbsp; File D:\CloakMail\lib\python\ZPublisher\Publish.py, =
line 238,=20
in publish_module<BR>&nbsp; File =
D:\CloakMail\lib\python\ZPublisher\Publish.py,=20
line 199, in publish<BR>&nbsp; File =
D:\CLOAKM~1\lib\python\Zope\__init__.py,=20
line 221, in zpublisher_exception_hook<BR>&nbsp;&nbsp;&nbsp; (Object:=20
Traversable)<BR>&nbsp; File =
D:\CloakMail\lib\python\ZPublisher\Publish.py, line=20
165, in publish<BR>&nbsp; File=20
D:\CloakMail\lib\python\ZPublisher\BaseRequest.py, line 450, in=20
traverse<BR>&nbsp; File=20
D:\CloakMail\lib\python\Products\LoginManager\LoginManager.py, line 236, =
in=20
validate<BR>&nbsp;&nbsp;&nbsp; (Object: ProviderContainer)<BR>NameError: =
(see=20
above)<BR></SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D230302904-06042001></SPAN></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_00EB_01C0BEAD.3D5B30E0--