windows bat file question

Tom Willis tom.willis at
Tue Mar 1 16:50:45 CET 2005

On Tue, 01 Mar 2005 10:12:29 -0500, Peter Hansen <peter at> 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
> --

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 = """
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.

Thomas G. Willis

More information about the Python-list mailing list