wx.lib.masked.IPAddrCtrl error

Ed Savage wrote:

Hello everyone!
My first post (and hopefully not my last!)

I'm having a problem with wx.lib.masked.IPAddrCtrl. Here is a code
snippet from my app and the error:

Snippet of my code:

import wx.lib.masked as masked

    self.myip = masked.IpAddrCtrl(self, -1, style = wx.TE_PROCESS_TAB)
    self.myip.SetValue(myconfig.Getvalue("ip_addr"))

-----------

ERROR:
Traceback (most recent call last):
  File "CtrlPanel.pyo", line 384, in IPDialog
  File "CtrlPanel.pyo", line 240, in __init__
  File "wx\lib\masked\ipaddrctrl.pyo", line 148, in SetValue
NameError: global name 'types' is not defined

I'm using Python 2.3.4 and wxpython 2.5.2.8u

Any ideas? I had thought about adding "import types" to the
ipaddrctrl.py but I decided against it until I checked with people
who know more than me :slight_smile:

Cheers

-Ed

This is a bug introduced when I split the ipaddrctrl into its own
file from a larger one (maskededit.py) that *did* import types.
(This was done when I split things up to create the masked package.)

It turns out that combobox suffers from the same issue as well.
I will submit a patch for this as soon as possible, but your fix
is the right one.

Regards,
/Will

···

_____________________________________________________________________

William Sadkin
Parlance Corporation
1-888-700-NAME
www.nameconnector.com

Thanks Will.

I added the "import types" but I get another error message:

Traceback (most recent call last):
  File "CtrlPanel.pyo", line 384, in IPDialog
  File "CtrlPanel.pyo", line 240, in __init__
  File "wx\lib\masked\ipaddrctrl.pyo", line 148, in SetValue
ValueError: value (122.122.122.122) must be a string of form n.n.n.n where n
is empty or in range 0-255

I then tried:
    self.myip = masked.IpAddrCtrl(self, -1, style = wx.TE_PROCESS_TAB)
    self.myip.SetValue('122.122.122.122')
which I thought should work and ended up with the same error message.

I then tried the same control with wxPython 2.5.1.5u (with the old
'maskededit' imports) and it worked fine. I'm not sure if there is another
bug with IPAddrCtrl or if I am being a total muppet. Anyone have any ideas?

Thanks

-Ed

···

-----Original Message-----
From: Will Sadkin [mailto:wsadkin@nameconnector.com]
Sent: 08 October 2004 19:48
To: 'wxPython-users@lists.wxwidgets.org'
Subject: RE: [wxPython-users] wx.lib.masked.IPAddrCtrl error

Ed Savage wrote:

Hello everyone!
My first post (and hopefully not my last!)

I'm having a problem with wx.lib.masked.IPAddrCtrl. Here is a code
snippet from my app and the error:

Snippet of my code:

import wx.lib.masked as masked

    self.myip = masked.IpAddrCtrl(self, -1, style = wx.TE_PROCESS_TAB)
    self.myip.SetValue(myconfig.Getvalue("ip_addr"))

-----------

ERROR:
Traceback (most recent call last):
  File "CtrlPanel.pyo", line 384, in IPDialog
  File "CtrlPanel.pyo", line 240, in __init__
  File "wx\lib\masked\ipaddrctrl.pyo", line 148, in SetValue
NameError: global name 'types' is not defined

I'm using Python 2.3.4 and wxpython 2.5.2.8u

Any ideas? I had thought about adding "import types" to the
ipaddrctrl.py but I decided against it until I checked with people
who know more than me :slight_smile:

Cheers

-Ed

This is a bug introduced when I split the ipaddrctrl into its own
file from a larger one (maskededit.py) that *did* import types.
(This was done when I split things up to create the masked package.)

It turns out that combobox suffers from the same issue as well.
I will submit a patch for this as soon as possible, but your fix
is the right one.

Regards,
/Will
_____________________________________________________________________

William Sadkin
Parlance Corporation
1-888-700-NAME
www.nameconnector.com

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org