wx.StandardPaths confusion

Paul McNett wrote:

Hi,

I'm trying to use wx.StandardPaths.GetTempDir(), but am confused by the tracebacks I'm getting:

>>> import wx
>>> wx.StandardPaths.GetTempDir()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unbound method GetTempDir() must be called with StandardPaths instance as first argument (got nothing instead)

Ok, I must need to instantiate it first:

>>> sp = wx.StandardPaths()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_misc.py", line 6027, in __init__
    def __init__(self): raise AttributeError, "No constructor defined"
AttributeError: No constructor defined

Hmm, must be something else to instantiate first?:

It's a singleton. Try this:

  sp = wx.StandardPaths.Get()
  sp.GetTempDir()

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!