command prompt change dir
inigoserna at terra.es
Sun Jul 13 22:13:33 CEST 2003
I think this is the solution midnight commander uses.
In lfm , I use something similar: I've created next shell function in
cd "`cat $LFMPATHFILE`";
rm -f -f $LFMPATHFILE
Before exit, the program writes the directory into a temporal file
/tmp/lfm-pid.path, where pid is the process id of lfm, then change the
I hope this helps,
El vie, 11-07-2003 a las 10:28, Martin Franklin escribió:
> On Friday 11 July 2003 07:39, Peter Vestergaard wrote:
> > Hi
> > Probably a simple question but I have not been able to find out how:
> > I want my python script to generate a path based on some simple lookups and
> > then change my path so that when the script exits my command prompt (from
> > which I launched the script) is standing at this path. The path already
> > exists.
> > I have tried chdir(path), system('cd '+path) and many others but none
> > changes my actual path.
> > Hope anyone can help
> > Regards, Peter Vestergaard
> I don't think it is possible to change the path of the calling program (in
> this case the command prompt you use to start the python script....)
> However you could use a shell trick to kind of do what you want:-
> # ChangePath script
> # invoke from command line like so:
> # cd `ChangePath.py`
> # simple lookup...
> path = "/usr/oracle/"
> print path
> Invoke the above from your command line (xterm or whatever...)
> cd `ChangePath.py`
> I have only tested this on Linux + bash and I would guess this would not work
> on Windows...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 196 bytes
Desc: Esta parte del mensaje est? firmada digitalmente
More information about the Python-list