Finding startup files

jeff elkins jeffelkins at earthlink.net
Wed May 11 23:04:42 EDT 2005


On Thursday 12 May 2005 05:24 am, Mike Meyer wrote:
> jeff elkins <jeffelkins at earthlink.net> writes:
> > On Wednesday 11 May 2005 04:44 pm, Grant Edwards wrote:
> >> On 2005-05-11, hemagician at gmail.com <hemagician at gmail.com> wrote:
> >> > The following script demonstrates a method that should work for you. I
> >> > believe it is entirely cross-platform.
> >> >
> >> > #! /usr/bin/python
> >> >
> >> > import sys
> >> > import os
> >> >
> >> > print os.path.abspath(os.path.dirname(sys.argv[0]))
> >>
> >> That will probably work most of the time, but...
> >>
> >>  1) you're not gauranteed that argv[0] contains the application
> >>     path/filename.
> >>
> >>  2) the directory containing the executable is not where
> >>     configuration files are supposed to be stored under
> >>     Unix/Linux.
> >
> > Thanks Grant,
> >
> > I live and develop in Linux, but unfortunately, 99.99% of the users of
> > this particular application (analysis of medical laboratory data) will be
> > working with Windows.
>
> Yes, but Windows these days supports multiple users. Are you sure that
> you want to restrict your users to one configuration file per
> installed version of the program?
>
> I'm not sure Windows has a good solution to this problem. My
> experiences with trying to share applications between users on Windows
> haven't been very pleasant.
>
>         <mike

With this particular app, a single config file per install is required. It 
sets up parameters that may vary from laboratory to laboratory but never do 
within a single lab.

However, it might be a good idea to check the environment and if running under 
*nix store configuration (and data files, which I didn't mention) in a sane 
manner. That would solve the symlink issue anyway...

Thanks for the feedback folks,

Jeff





More information about the Python-list mailing list