This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jmurff
Recipients
Date 2003-03-04.22:51:02
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Discoved this when using Pmw with 2.3a1 and a2 found atoi 
doesn't work properly. So, I wrote a small test:
------------------
import string
if __name__ == __main__:
   num = atoi(test, 10)
------------------

Always get and exception from  it and using Pmw that is the 
same:
<...>
python2.3/string.py, line 220
   return _int(s, base)
TypeError: int() can't convert non-string with explicit base

Seems to always pass a string like it asks for.
I can also reproduce by using the MenuBar.py and 
MainMenuBar.py in Pmw/Pmw1.1/demos.

I fixed it by looking at python2.3/stringold.py. I took the guts of 
atoi from there.

So it was:
---------------
def atoi(s, base=10) :
     return _int(s, base)

It is now:
--------------
def atoi(*args) :

    try:
       s = arg[0]
    except IndexError:
       raise TypeError('function requires a least one argument: %d 
given' % len(args))

    return apply(_int, args)

Hope this helps. Not sure if it is best way to fix it but solved all our 
errors using atoi for now. 
Let me know if you need more info. - jmurff@pacbell.net
History
Date User Action Args
2007-08-23 14:11:40adminlinkissue697591 messages
2007-08-23 14:11:40admincreate