windows bat file question

Steve Holden steve at holdenweb.com
Tue Mar 1 11:05:34 EST 2005


Tom Willis wrote:
> On Tue, 01 Mar 2005 10:12:29 -0500, Peter Hansen <peter at engcorp.com> wrote:
> 
>>Tom Willis wrote:
>>
>>>I'm trying to get pylint running on windows and the bat file for it
>>>seems a little screwy. I'm hoping someone may have figured this out
>>>already.
>>>...
>>>All I get is the python prompt, the lines starting at import sys don't
>>>run.  If I throw the lines in a python script, I run into path issues.
>>
>>What exact command are you typing to try to run it?  Where is
>>the script relative to the current directory?    (Best is to
>>cut and paste a copy of the actual command line and result
>>that you have in your console.)
>>
>>On the topic of the "path issues" in the other case, what do you
>>mean by path issues?  DOS path issues?  sys.path issues?  Something
>>else?  What issues exactly...
>>
>>-Peter
>>--
>>http://mail.python.org/mailman/listinfo/python-list
>>
> 
> 
> I figured it out. I just took the embedded python code that was in the
> batch file distributed with it and put it in it's own module.
> 
> Really my question was how would this ever work? It seems to me to be
> a little screwy, but it would be handy to know if this was some sort
> of convention that I could take advantage of if I ever write something
> substantial that would need to run on windoze.
> 
> 
> REM---bat file---
> rem = """-*-Python-*- script
> @echo off
> rem -------------------- DOS section --------------------
> rem You could set PYTHONPATH or TK environment variables here
> python %*
> goto exit
> 
> """
> # -------------------- Python section --------------------
> print "hello from python"
> 
> DosExitLabel = """
> :exit
> rem """
> REM---end of bat file---
> 
> I'm wondering if this took advantage of some flaw in batch file
> processing that can no longer be used because of some security hole
> that got plugged or something.
> 
> 
> 
> 
It was clearly originally intended to be run as "name" and then pipe the 
batch file into the Python interpreter, but as to how the hell it was 
actually supposed to work, your guess is as good as mine.

regards
  Steve


-- 
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005                      http://www.pycon.org/
Steve Holden                           http://www.holdenweb.com/



More information about the Python-list mailing list