Wxpython 2.8 conflict with Windows OS

I've been learning python and wxpython for about a year ... I am using
python 2,6 and wxpython 2.8 window OS.... the problem is I have a
glitch with .GetStringSelection())... it doesn't always happen and
it's on the Pulse = str(self.pulse.GetStringSelection()) ... I get a
AttibuteError 'str' object has no attribute GetStringSelection.... the
weird thing is it doesn't happen all the time (i don't know what the
conditions are My trace back reveals nothing ) it's that particular
line bypassing other GetStringSelection to get to that one ... if I
remove the line it give the error for the next line ... This has led
me to believe that their is a conflict between wxpython and some
periodic operation windows OS carries out ... We looked at the sleep
and hibernate function and ruled them out ...has anyone seen this
glith before ? what causes it and what it the solution ? is their a
more stable way to get my info the GetStringSelection

def OnInsert(self, event):
  try:
      con = lite.connect('specialeventms2.sqlite')
      cur = con.cursor()
      Incident_number=(str(self.Ic_num))
      Last_Name = str(self.tc1.GetValue())
      First_Name =str(self.tc2.GetValue())
      Age = str(self.tc3.GetValue())
      Gender = str(self.cb3.GetStringSelection())
      Address = str(self.tc4.GetValue())
      City = str(self.tc5.GetValue())
      State = str(self.tc6.GetStringSelection())
      Zip = str(self.tc7.GetValue())
      Ailment = str(self.cb1.GetStringSelection())
      Treatment = str(self.cb2.GetStringSelection())
      Patient_reprt = str(self.pr1.GetValue())
      Initial_contact = str(self.initContact)
      Hospital = str(self.Hospital1)
      Destination =str(self.tc69.GetStringSelection())
      Inservice = str(self.Inservice)
      Provider_1 = str(self.tc20.GetStringSelection())
      Provider_2= str(self.tc21.GetStringSelection())
      Sys = str(self.systolic.GetStringSelection())
      Dia = str(self.diastolic.GetStringSelection())
      Pulse = str(self.pulse.GetStringSelection())

      Resp = str(self.respiration.GetStringSelection())
      Weather = str(self.weather1a)
      Temp= str(self.weather2a)
      Humid = str(self.weather3a)
      Wind=str(self.weather4a)
      TimeStamp =str(self.weather5a)

Hi,

···

On Mon, Oct 10, 2011 at 10:39 AM, aikidoguy <clayrichmond1@gmail.com> wrote:

I've been learning python and wxpython for about a year ... I am using
python 2,6 and wxpython 2.8 window OS.... the problem is I have a
glitch with .GetStringSelection())... it doesn't always happen and
it's on the Pulse = str(self.pulse.GetStringSelection()) ... I get a
AttibuteError 'str' object has no attribute GetStringSelection.... the
weird thing is it doesn't happen all the time (i don't know what the
conditions are My trace back reveals nothing ) it's that particular

The exception is saying that 'self.pulse' is a string.

Look through your code, somewhere you must be assigning 'self.pulse'
to be a string instead of the control it is to begin with.

Cody

That point to a problem in your code. At some point "self.pulse" is changed from a control (combobox or similar) to be a string.

why are you doing:

Pulse = str(self.pulse.GetStringSelection())

GetStringSelection()

     Returns the label of the selected item or an empty string if no item is selected.

     Returns:

     string

This should be fine:

Pulse = self.pulse.GetStringSelection()

You might also want to look into validators to do this kind of transfer of data with less repetitive code. Check the wiki, doc and this list there have been a few threads on validators in the past.

Werner

···

On 10/10/2011 05:39 PM, aikidoguy wrote:

I've been learning python and wxpython for about a year ... I am using
python 2,6 and wxpython 2.8 window OS.... the problem is I have a
glitch with .GetStringSelection())... it doesn't always happen and
it's on the Pulse = str(self.pulse.GetStringSelection()) ... I get a
AttibuteError 'str' object has no attribute GetStringSelection....