Python not finding installed function

Installed on this host is

/usr/lib/python2.7/site-packages/wx-3.0-gtk2/wx/lib/sized_controls.py

which includes GetContentsPane(). However, when I try to use this function
Python cannot find it. Two examples:

Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/wx-3.0-gtk2/wx/_core.py", line
16763, in <lambda>
     lambda event: event.callable(*event.args, **event.kw) )
   File "./pw.py", line 4109, in showLogin
     self.doShowLogin()
   File "./pw.py", line 4112, in doShowLogin
     with LoginDialog() as dlg:
   File "./pw.py", line 274, in __init__
     contentPane = self.GetContentsPane()
AttributeError: 'LoginDialog' object has no attribute 'GetContentsPane'

and

[rshepard@salmo ~]$ python
Python 2.7.5 (default, May 29 2013, 03:26:28) [GCC 4.8.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import wx.lib.sized_controls as sc
contentPane = GetContentsPane()

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
NameError: name 'GetContentsPane' is not defined

   That function is found in two places in sized_controls.py:

[rshepard@salmo ~]$ grep GetContentsPane
/usr/lib/python2.7/site-packages/wx-3.0-gtk2/wx/lib/sized_controls.py
         pane = self.GetContentsPane()
     def GetContentsPane(self):
         pane = self.GetContentsPane()
     def GetContentsPane(self):

   I'm at a loss how to resolve this because the syntax for import and use
are the same as in the Wiki and in Werner's code that works for him.

Rich

Rich, can you post the code for the class that begins?:

class LoginDialog(etc...)

The problem might be there.
-Che

···

On Sat, Jul 26, 2014 at 1:38 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

  Installed on this host is

/usr/lib/python2.7/site-packages/wx-3.0-gtk2/wx/lib/sized_controls.py

which includes GetContentsPane(). However, when I try to use this function
Python cannot find it. Two examples:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/wx-3.0-gtk2/wx/_core.py", line
16763, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "./pw.py", line 4109, in showLogin
    self.doShowLogin()
  File "./pw.py", line 4112, in doShowLogin
    with LoginDialog() as dlg:
  File "./pw.py", line 274, in __init__
    contentPane = self.GetContentsPane()
AttributeError: 'LoginDialog' object has no attribute 'GetContentsPane'

and

[rshepard@salmo ~]$ python
Python 2.7.5 (default, May 29 2013, 03:26:28) [GCC 4.8.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import wx.lib.sized_controls as sc

contentPane = GetContentsPane()

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>
NameError: name 'GetContentsPane' is not defined

  That function is found in two places in sized_controls.py:

[rshepard@salmo ~]$ grep GetContentsPane
/usr/lib/python2.7/site-packages/wx-3.0-gtk2/wx/lib/sized_controls.py
        pane = self.GetContentsPane()
    def GetContentsPane(self):
        pane = self.GetContentsPane()
    def GetContentsPane(self):

  I'm at a loss how to resolve this because the syntax for import and use
are the same as in the Wiki and in Werner's code that works for him.

Rich

It's your code's problem, the exceptions mention all your file names or stdin (typed by keyboard). For example you import as sc... But then you don't call sc.GetContentPane()

it is a member of sc.SizedDialog, so I think your class is not defined as:

class LoginDialog(sc.SizedDialog):

Werner

···

On 7/26/2014 19:38, Rich Shepard wrote:

  Installed on this host is

/usr/lib/python2.7/site-packages/wx-3.0-gtk2/wx/lib/sized_controls.py

which includes GetContentsPane(). However, when I try to use this function
Python cannot find it. Two examples:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/wx-3.0-gtk2/wx/_core.py", line
16763, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "./pw.py", line 4109, in showLogin
    self.doShowLogin()
  File "./pw.py", line 4112, in doShowLogin
    with LoginDialog() as dlg:
  File "./pw.py", line 274, in __init__
    contentPane = self.GetContentsPane()
AttributeError: 'LoginDialog' object has no attribute 'GetContentsPane'

Che,

   Yep, that's where the problem was. I had the parent class as wx.Dialog
rather than sc.SizedDialog.

   That's fixed and now I need to fix size and empty frame issues.

Thanks,

Rich

···

On Sat, 26 Jul 2014, C M wrote:

Rich, can you post the code for the class that begins?:

class LoginDialog(etc...)

The problem might be there.