[Tutor] sound implementation problems
Dave Angel
davea at davea.name
Fri Jun 14 22:35:21 CEST 2013
On 06/14/2013 11:43 AM, Jim Mooney wrote:
> On 13 June 2013 21:53, Dave Angel <davea at davea.name> wrote:
>
>> On 06/13/2013 11:55 PM, Jim Mooney wrote:
>>
>>> Alan Gauld <alan.gauld at btinternet.com>
>>>
>>
> This is for my own convenience on my own machine. As a former webmaster I'm
> of course used to idiot-proofing anything released into the wild so it is
> usable by everyone on every machine ;')
>
> The script to change directories for PyScripter is a PyScripter startup
> file, not a bat file. I meant I needed an additional bat file that would do
> the same for MS-DOS.
You're not running MS-DOS. You're running a DOS BOX under Windows,
which is a cmd shell.
As usual I was marvelously unclear. But anyway, I
> figured it out. Here is the batch for starting 2.7 and ensuring its in the
> 2.7 working directory. Since I'm running 2.7 and 3.3 I just want to make
> sure I don't trip over my own feet. I know I could do all this with
> virtualenv, but I'd rather a simple hack than all that mess. The two Pys
> are now separated in every possible way:
>
> MS batch file py27.bat
>
> python2.7 -i -c "import os;os.chdir('c:/python27/jimprogs');del(os)
>
That seems rather silly. Why not
------py27.bat-------
c:
cd \python27\jimprogs
python2.7 %$
---------------------
I probably don't have the right syntax for %$, but there is a
pseudo-variable you can use which means "all the parameters that were on
the batch file invocation. This is the generalization of %1 %2 %3 %4
There's also a pair of cmd.exe internal commands, with names something
like SETLOCAL and ENDLOCAL that let you save and restore the
current state of the environment including drive letter and current
directory.
------py27.bat-------
SETLOCAL
c:
cd \python27\jimprogs
python2.7 %$
ENDLOCAL
---------------------
Or you could use PUSHD and POPD if the only thing you're customizing is
the directory.
--
DaveA
More information about the Tutor
mailing list