windows/distutils question

Discussion in 'Python' started by Paul Rubin, Jun 28, 2005.

  1. Paul Rubin

    Paul Rubin Guest

    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.
     
    Paul Rubin, Jun 28, 2005
    #1
    1. Advertising

  2. Paul Rubin

    Guest

    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
     
    , Jun 28, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Phil Hornby

    Distutils windows binaries...

    Phil Hornby, Feb 2, 2004, in forum: Python
    Replies:
    0
    Views:
    296
    Phil Hornby
    Feb 2, 2004
  2. Brian Elmegaard

    distutils for non-python windows installers

    Brian Elmegaard, Oct 27, 2004, in forum: Python
    Replies:
    3
    Views:
    450
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Oct 29, 2004
  3. timw.google
    Replies:
    1
    Views:
    558
    Serge Orlov
    May 11, 2006
  4. Luis Alberto Zarrabeitia Gomez

    distutils, No module named numpy.distutils.fcompiler.conv_template

    Luis Alberto Zarrabeitia Gomez, Mar 30, 2009, in forum: Python
    Replies:
    0
    Views:
    1,356
    Luis Alberto Zarrabeitia Gomez
    Mar 30, 2009
  5. Seb S
    Replies:
    1
    Views:
    217
    Mark Hammond
    Jun 5, 2011
Loading...

Share This Page