[wxPython-users] wx.StandardPaths confusion

Werner F. Bruhin werner.bruhin at free.fr
Thu Sep 13 09:45:40 PDT 2007


Paul,

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?:
>
>
> >>> dir(wx.StandardPaths)
> ['Get', 'GetConfigDir', 'GetDataDir', 'GetDocumentsDir', 
> 'GetExecutablePath', 'GetInstallPrefix', 'GetLocalDataDir', 
> 'GetLocalizedResourcesDir', 'GetPluginsDir', 'GetResourcesDir', 
> 'GetTempDir', 'GetUserConfigDir', 'GetUserDataDir', 
> 'GetUserLocalDataDir', 'ResourceCat_Max', 'ResourceCat_Messages', 
> 'ResourceCat_None', 'SetInstallPrefix', '__class__', '__delattr__', 
> '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', 
> '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', 
> '__setattr__', '__str__', '__weakref__', 'thisown']
>
>
> I don't see anything...
The demo is your helper ;-)

# get the global (singleton) instance of wx.StandardPaths
        sp = wx.StandardPaths.Get()

Werner




More information about the wxpython-users mailing list