Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigParser.getint failure on 2.3.3 #39723

Closed
zgoda mannequin opened this issue Dec 21, 2003 · 3 comments
Closed

ConfigParser.getint failure on 2.3.3 #39723

zgoda mannequin opened this issue Dec 21, 2003 · 3 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@zgoda
Copy link
Mannequin

zgoda mannequin commented Dec 21, 2003

BPO 864063
Nosy @freddrake
Files
  • cp-getint-bug.py: Bug or not bug?
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/freddrake'
    closed_at = <Date 2004-05-18.11:47:45.000>
    created_at = <Date 2003-12-21.18:37:33.000>
    labels = ['library']
    title = 'ConfigParser.getint failure on 2.3.3'
    updated_at = <Date 2004-05-18.11:47:45.000>
    user = 'https://bugs.python.org/zgoda'

    bugs.python.org fields:

    activity = <Date 2004-05-18.11:47:45.000>
    actor = 'zgoda'
    assignee = 'fdrake'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2003-12-21.18:37:33.000>
    creator = 'zgoda'
    dependencies = []
    files = ['1144']
    hgrepos = []
    issue_num = 864063
    keywords = []
    message_count = 3.0
    messages = ['19452', '19453', '19454']
    nosy_count = 2.0
    nosy_names = ['fdrake', 'zgoda']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue864063'
    versions = ['Python 2.3']

    @zgoda
    Copy link
    Mannequin Author

    zgoda mannequin commented Dec 21, 2003

    It fails with this traceback:
    jarek:~/projekty/jpawrk/trunk$ ./jpa.py
    Traceback (most recent call last):
      File
    "/home/jarek/projekty/jpawrk/trunk/lib/jt_mainwindow.py",
    line 328, in OnMessageEdit
        self.cfg)
      File
    "/home/jarek/projekty/jpawrk/trunk/lib/jt_msgeditwindow.py",
    line 35, in editMessage
        dlg = MsgEditDlg(tmp, config)
      File
    "/home/jarek/projekty/jpawrk/trunk/lib/jt_msgeditwindow.py",
    line 69, in __init__
        self.__setProperties(config)
      File
    "/home/jarek/projekty/jpawrk/trunk/lib/jt_msgeditwindow.py",
    line 76, in __setProperties
        winSize = cfg.getWindowSize('msgedit')
      File
    "/home/jarek/projekty/jpawrk/trunk/lib/jt_cfg.py", line
    66, in getWindowSize
        return (self.cp.getint(windowName, 'width'),
      File "/usr/lib/python2.3/ConfigParser.py", line 315,
    in getint
        return self._get(section, int, option)
      File "/usr/lib/python2.3/ConfigParser.py", line 312,
    in _get
        return conv(self.get(section, option))
      File "/usr/lib/python2.3/ConfigParser.py", line 518,
    in get
        return self._interpolate(section, option, value, d)
      File "/usr/lib/python2.3/ConfigParser.py", line 557,
    in _interpolate
        if value.find("%(") != -1:
    AttributeError: 'int' object has no attribute 'find'

    The offending line in ConfigParser.py is line 553 which
    reads:
    value = rawval
    In case of non-string values this will fail later,
    since find() is a string method. Changing this line to:
    value = str(rawval)
    helps in case of numeric values (didn't check with
    booleans, though).

    @zgoda zgoda mannequin closed this as completed Dec 21, 2003
    @zgoda zgoda mannequin assigned freddrake Dec 21, 2003
    @zgoda zgoda mannequin added the stdlib Python modules in the Lib dir label Dec 21, 2003
    @zgoda zgoda mannequin closed this as completed Dec 21, 2003
    @zgoda zgoda mannequin assigned freddrake Dec 21, 2003
    @zgoda zgoda mannequin added the stdlib Python modules in the Lib dir label Dec 21, 2003
    @freddrake
    Copy link
    Member

    Logged In: YES
    user_id=3066

    Are you passing non-string values to the .set() method? The
    _interpolate() method is called before ConfigParser even
    performs data conversion, so it should only see strings.

    The script being run in the traceback you show was not
    attached, so I can't be sure how you're using ConfigParser.

    The documentation for the .set() method has been found
    lacking; this has been fixed in response to another bug
    report. Starting with Python 2.4, passing a non-string as
    the value to the .set() method will cause a TypeError to be
    raised.

    If you were *not* passing a non-integer as the value
    argument of the .set() method, please respond to this bug
    report; a short script that demonstrates the problem would
    help us diagnose the problem more carefully.

    @zgoda
    Copy link
    Mannequin Author

    zgoda mannequin commented May 18, 2004

    Logged In: YES
    user_id=92222

    Thanks for clarification. And yes, the value passed to
    .set() is of integer type, as may be found in attached script.
    I am closing this report with resolution "Fixed".

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant