Problem with string -> int conversion ?



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

.



Relevant Pages

  • Not first class in file
    ... loading the designer again. ... Public strTo As String ... ' This call is required by the Component Designer. ... Protected Overloads Overrides Sub Dispose ...
    (microsoft.public.dotnet.languages.vb)
  • Re: DataTable Designer in VS2008
    ... Your problem here is not with the designer but with the T-SQL language. ... taking a string parameter and returning a table: ... WHERE primaryKeyID IN ...
    (microsoft.public.vstudio.development)
  • Custom property on form not persisting value in VS 2005
    ... Private _Title As String ... - Then I go into class diagram to add the designer stuff... ... In the application I then add a form inheriting from the one in the class ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: 3 Fragen zu WebControl
    ... Definitiv sind aber die Werte für das Category-Attribut Englisch. ... Attribute haben nur einfluss auf die designer in VS nicht aufs aussehen ... public override string GetDesignTimeHtml() ...
    (microsoft.public.de.german.entwickler.dotnet.asp)
  • Change Rave Report Connection String at runtime
    ... I've created some basic Rave Reports (using the designer which came ... with D2005) and I want to change the string for the database connection ... I can easily sort out the drive letter, but I can't seem to find the ...
    (comp.lang.pascal.delphi.misc)