On 01/09/2011 15:04, Werner F. Bruhin wrote:
On 09/01/2011 02:49 PM, Tim Golden wrote:
On 01/09/2011 13:39, Kevin Walzer wrote:
Hi,
I’m getting feedback from a Windows user that says my Tkinter app won’t
write data to an app temporary directory. Here’s my code:
sys.stderr=open(os.path.join(os.path.expanduser('~'), 'Application
Data', 'QuickWho', 'QuickWho_errors.txt'), 'w')
This is a little brittle. I imagine it will at least break
from non-English versions of Windows. It will also break
for versions of Python prior to 2.5? when expanduser was
expanded to include Windows.
The simplest approach is to use the APPDATA env var which
goes back a few versions (certainly to XP, probably Win 2000).
Alternatively, you can use the Windows Shell API to query the
same thing -- this should go back even further if you've got
someone using something truly prehistoric.
Not that this helps Kevin, in wxPython there is "wx.StandardPaths" which
does a pretty good job of getting the right path.
Was hoping that I could point you to the source, but it looks that this
is mostly implemented in wxWidget and therefore is in C++ and not in
Python.
Would be nice to have something like this in pure Python - anyone who
"speaks" C++ and has some free time on his/her hand:).
This might help...?
http://timgolden.me.uk/python/winshell.html
TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32