0

This question is most likely on here somewhere, and anyone who can redirect me, that would be great.

But I can't find it - most likely not sure which appropriate key terms to use as everything gives me the python command line interpreter.

But I simply want to be able to use the output from a python as the input to another program from the command line. For example:

./program `python print 'A' * 100`

However, I get an error of:

python: can't open file 'print': [Errno 2] No such file or directory

What is the proper way to do this?

Remi Guan
22.5k17 gold badges68 silver badges90 bronze badges
asked Oct 28, 2015 at 22:41
1
  • Interesting collection of other redirection options in python, worth a read, here Commented Oct 28, 2015 at 22:49

2 Answers 2

1

the python executable with no switches expects no arguments(for an interactive shell) or a *.py file to run

you can use the -c switch to pass in code

./program `python -c "print 'A' * 100"`
answered Oct 28, 2015 at 22:44
Sign up to request clarification or add additional context in comments.

Comments

0
python -c "print 'A' * 10" | ./program
Remi Guan
22.5k17 gold badges68 silver badges90 bronze badges
answered Oct 28, 2015 at 22:44

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.