Finding startup files

Mike Meyer mwm at mired.org
Thu May 12 01:24:55 EDT 2005


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
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list