newbie, relative path
Andrei Kulakov
sill at optonline.net
Wed Oct 31 19:41:42 EST 2001
On Wed, 31 Oct 2001 13:01:08 GMT, Marcus Stojek <stojek at part-gmbh.de> wrote:
> Hi,
> 2 little questions.:
>
> 1.
> I have a small script that uses an .ini file for configuration. How
> can I open the file config.ini that is in the same dir as the script
> itself? (script dir is changing)
>
> config=open("?????config.ini","r")
Generally speaking, conf files are kept in a path that's hard-coded in a
script, e.g.:
conf_file = os.path.expanduser("~/.myprog.conf")
Afaik, there is no elegant/easy way to determine where the script that's
being executed is located at, and there's no need for that, really. You
should keep the conf file in homedir, as a hidden file, that was it's easy
to edit whenever you want to make a change.
Oh, I just realized you use windows.. well, just make some dir that $HOME
would point to (normally c:\windows?), and have the conf file there,
there's no reason why conf file should be in the same dir with the
script..
>
> 2.
> I am pretty sure that I have read somewhere that it is possible
> to link the Python Interpreter and everthing together and make
> a binary executabel (WIN) from the script. I don't find this in
> "Programming Python" or "Learning Python" any more.
There's a few, the most well known one I think is py2exe.
>
> Is it possible and where can I find a description?
>
> Thanks again.
>
> Marcus
--
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org
More information about the Python-list
mailing list