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. TJG _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32