Problems with exec scoping (solved)

Erik Walthinsen omega at temple-baptist.com
Mon Jun 3 00:28:24 EDT 2002


On Sun, 02 Jun 2002 20:49:54 -0700, Erik Walthinsen wrote:


> The problem I'm running into now is that if I print out the repr() of
> the 'objects' variable from within the python in the HTML page, I get a
> dict with the right keys, but the values of each of the keys are
> non-existant. This obviously puts a bit of a crimp in my plans, since
> the whole point of making the dict available is to use the objects
> contained.

Well, it turns out that I was being an idiot and not checking the source
of the returned HTML page.  When repr() is run on an object, it returns a
string such as:

<captiveclient.CaptiveClient instance at 0x8189264>

...which conveniently doesn't get displayed as text in a browser, looking
as much like HTML as it does.  I discovered this as I wrote a __repr__()
function for the class and had large chunks of the page disappear because
I didnt stick a trailing ">" on the returned string.  Switching to "[]"
solved the problem.

I will now go and see about writing a HTML-textizer for use in such
situations.

      Erik Walthinsen <omega at temple-baptist.com> - System Administrator
        __
       /  \                GStreamer - The only way to stream!
      |    | M E G A        ***** http://gstreamer.net/ *****
      _\  /_



More information about the Python-list mailing list