Thread: tracing

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    1
    Rep Power
    0

    tracing


    Hello,

    I am tracing a python function and something goes wrong when in the function
    or inner functions an exception occurs.I use an indentation when calling an
    d returning from a function but everything goes wrong when an exception come
    s up.Is the exception seen as a new frame?And when a function terminates wit
    h an unhandled exception how can I go back to my identation?

    Some piece of the outcome:

    tkIni.get('self', 'section', 'item', 'default') -- File tkini.py, line 55
    | tkDebug.write('self', 'text') -- File tkdebug.py, line 66
    | Done tkDebug.write('self', 'text').
    | ConfigParser.get('self', 'section', 'option', 'raw', 'vars')
    Exception: /tmp/python.2568/usr/lib/python2.4/ConfigParser.py:508:KeyError:J
    ob(in get)
    | | NoSectionError.__init__('self', 'section') -- File ConfigParser.py, line
    121
    | | | Error.__init__('self', 'msg') -- File ConfigParser.py, line 109
    | | | Done Error.__init__('self', 'msg').
    | | Done NoSectionError.__init__('self', 'section').
    Exception: /tmp/python.2568/usr/lib/python2.4/ConfigParser.py:511: NoSection
    Error: No section: 'Job' (in get)
    Exception: /tmp/python.2568/usr/lib/python2.4/ConfigParser.py:511: NoSection
    Error: No section: 'Job' (in get)
    | | tkDebug.write('self', 'text') -- File tkdebug.py, line 66
    | | Done tkDebug.write('self', 'text').
    Exception: /tmp/python.2568/usr/lib/python2.4/ConfigParser.py:511: NoSection
    Error: No section: 'Job' (in get)
    | | tkevent.initEnvironment('self') -- File tkevent.py, line 55

    ConfigParser.get() in line 5 terminates with exception and is supposed to go
    one indentation back, same for the last exception it's supposed to mark the
    end of the tkini.get() function and go one indentation back so that tkevent
    .initEnvironment() should begin without any indentation.

    Thanks in advance.
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Umm, a lot of that code is incorrect. For instance, tkDebug.write() shouldn't have 'self' in there, self (not 'self') is mainly used in Python classes. You also didn't provide enough data for us to help you with your problem. Post again with all of the error message(s) that you receive.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2005
    Posts
    174
    Rep Power
    11
    Originally Posted by be_veronic
    Hello,
    tkIni.get('self', 'section', 'item', 'default') -- File tkini.py, line 55
    | tkDebug.write('self', 'text') -- File tkdebug.py, line 66
    | Done tkDebug.write('self', 'text').
    | ConfigParser.get('self', 'section', 'option', 'raw', 'vars')
    Exception: /tmp/python.2568/usr/lib/python2.4/ConfigParser.py:508:KeyError:J
    ob(in get)
    Yes and welcome to the issues regarding ConfigParser Does everyone rewrite this module? Anyway, it can be finiky with GUI elements as was my experience with Pythoncard.

    Since your code is not listed we can only guess however on what's happening, so I'd encourage you to post the code. My simple guess is either the section count has run out of elements, causing an Exception, or likewise your elements are of the wrong length, thereby running out of elements sooner, and again causing an Exception. Maybe try .items() instead of .get() to gauge how it sees your file sections. This is just the start though.

    from http://docs.python.org/lib/ConfigParser-objects.html we get:

    The ConfigParser class extends some methods of the RawConfigParser interface, adding some optional arguments.

    get( section, option[, raw[, vars]])

    Get an option value for the named section. All the "%" interpolations are expanded in the return values, based on the defaults passed into the constructor, as well as the options vars provided, unless the raw argument is true.

    items( section[, raw[, vars]])

    Return a list of (name, value) pairs for each option in the given section. Optional arguments have the same meaning as for the get() method. New in version 2.3.
    play around with ConfigParser.items(yoursection) in console and work backwards. Posting your code would be a big help though.

    cheers
    sf2k

IMN logo majestic logo threadwatch logo seochat tools logo