Problem with string -> int conversion ?
- From: Madhusudan Singh <spammers-go-here@xxxxxxxxxxxx>
- Date: Tue, 30 Aug 2005 18:22:12 -0400
Hi
I am working with an application that I designed with the Designer > pyuic
workflow and I get the following error on trying to process the contents of
a combobox :
Traceback (most recent call last):
File "measure.py", line 908, in acquiredata
np=self.getNPrange()
File "measure.py", line 1167, in getNPrange
signalrange=int(signalrangestr)
TypeError: int() argument must be a string or a number
The code is :
void Form3::getNPrange()
{
signalrangestr=self.NPcombobox.currentText()
signalrange=int(signalrangestr)
if globaldebug : print 'NP Signal range = ',signalrange
return signalrange
}
The contents of the combobox are strings representing numbers in the range
[0,6].
Isn't signalrangestr above a string ? Or at the very least, a number. I
entered these numbers myself in designer, so they do not have any
white-space (len(signalrangestr) returns 1). In any case, an attempt to use
strip() fails with :
Traceback (most recent call last):
File "measure.py", line 908, in acquiredata
np=self.getNPrange()
File "measure.py", line 1169, in getNPrange
signalrange=int(signalrangestr.strip())
AttributeError: strip
.
- Follow-Ups:
- Re: Problem with string -> int conversion ?
- From: Fredrik Lundh
- Re: Problem with string -> int conversion ?
- Prev by Date: Re: OpenSource documentation problems
- Next by Date: Bicycle Repair Man usability
- Previous by thread: Bicycle Repair Man usability
- Next by thread: Re: Problem with string -> int conversion ?
- Index(es):
Relevant Pages
|
|