Python newbie here.
I created a Python program,
msg.py
, which outputs a message (Hello, World).I created a Python program,
id.py
, which reads input and outputs it.Using
py2exe
I created an executable of each of them:msg.exe
andid.exe
I created a DOS batch file, set
PATH
to thedist
folder ofmsg.exe
and thedist
folder ofid.exe
.I then added this to the DOS batch file:
msg | id
When I ran the batch file I got this error message:
Traceback (most recent call last):
File "id.py", line 4, in <module>
IndexError: list index out of range
I surmised that the pipe symbol is not feeding the output of msg.exe
to the input of id.exe
. Is that correct?
So then I placed this in the batch file:
id < msg
When I ran the batch file I got this error message:
Access is denied.
I really want step 5
to work. That is, I really want to be able to compose programs using the pipe symbol, like so:
A | B | C | ...
Ideally A
, B
, C
, ... could be executables written in various languages, such as Python
, C
, etc.
How do I get this to work?
Below are the details of what I did. I am running on Windows 7.
Here is msg.py
import stdio
stdio.writeln('Hello, World')
Here is id.py
import sys
import stdio
msg = sys.argv[1]
stdio.writeln(msg)
Here is my DOS batch file:
@echo OFF
set PATH=%PATH%;msg/dist;id/dist
msg | id