By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,270 Members | 1,703 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,270 IT Pros & Developers. It's quick & easy.

windows/distutils question

P: n/a
I'm trying to package a windows app with distutils (you've heard about
it before). The app needs to store some data on disk and apparently
the right place to put it is in the "Application Data" directory. The
only way I see to find out the name of this directory is the
get_special_folder_path function in the postinstallation script
(CSIDL_APPDATA). So I call that function and get the directory name,
which work ok.

There's just one problem: how do I store the name so the application
can use it? My obvious idea is to just make an "appdir.py" file
containing something like

# automatically generated by postinstallation script
application_directory = "C:\windows\documents and settings\username\application data"

but the point is that I need appdir.py to be stored in the directory
where the application code itself lives, i.e. the installation target
directory. And I don't see a way to find THAT from the
postinstallation script. The postinstallation script seems to run
with working directory equal to wherever you launched it from.

Note: using os.path.expanduser('~/Application Data') doesn't work
because the person may be using a non-English version of Windows and
that directory would have a different name.

Thanks for any ideas.
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If the environment variable:

os.environ['APPDATA']

is present on non-English Windows, you may be able to use that to get
what you need.

john

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.