All Questions
Tagged with stdin python-3.x
119
questions
2
votes
0
answers
38
views
Writes to child subprocess.Popen.stdin don't work from within process group?
From within a Python script, I'm launching an executable in a subprocess (for anyone interested: it's the terraria server).
# script.py
server_process = subprocess.Popen("my_executable arg1 arg2&...
0
votes
0
answers
28
views
Is there realised solutions to unpack `stdin` as arguments? [duplicate]
I would like to have the option to pass positional arguments via stdin. I have written my own argparse.Action subclass to overwhelm the problem, that does work, but it would be desirable to evade ...
1
vote
0
answers
21
views
If function in stdin [duplicate]
how to get a match string from stdin?
import sys
def loop():
for word in sys.stdin:
print(word)
if word == 'shai':
print('yes')
loop() ...
1
vote
0
answers
53
views
Pipeing input to a Java process from Python - Java process does not receive input
I have a Java process that has the following logic:
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while (true) {
String line;
LOGGER.info("...
0
votes
2
answers
459
views
How to mock stdin when using fileinput module?
I have a program that uses the Python fileinput module, and I am trying to write unittests for the main() function. They work find when using an actual file, but raise OSError: reading from stdin ...
1
vote
2
answers
239
views
How to split data from standard input?
I have some number of lines in data for input:
data = sys.stdin.readlines()
Find out the number of lines:
l = len(data)
How can I split this data into variables?
For example I have the following ...
0
votes
0
answers
245
views
Pass commands to interactive shell in python
I have an ELF file (executable file), which after execution gives you a shell, something like this:
$./execute-me <- executing this file
# whoami <- it has provided me a shell(popped a shell) ...
0
votes
2
answers
345
views
Python cannot read Stdin input on Windows and reacts like an infinite loop
I have a problem that only appears on Windows 10 when I run a python script from the console (or a ProcessBuilder in Java) with an stdin input.
When I run this code on Ubuntu :
import sys
print(sys....
0
votes
1
answer
2k
views
python stdin: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 0: invalid continuation byte
I'm trying to use stdin(standard input) as input for my codes.
this is how I have implement for now. I was trying to see whether it give output that I am intended.
import sys
for i in sys.stdin....
0
votes
0
answers
15
views
Reading from a running process/Python app, that is printing to console? [duplicate]
Please help me find out if this is possible. Follow me here with this explanation.
The important thing is, I do not want to invoke/run/launch a python program, from within another python program. I ...
0
votes
1
answer
637
views
using select stdin for non blocking input python
I want to create a process that has 3 sub processes, 2 to handle websockets and one to get input from terminal to pass to the other two sockets.
import sys
import time
import select
import asyncio
...
0
votes
0
answers
25
views
Python3 If Else statement SyntaxError and IndentationError [duplicate]
I am new to Python and Stackoverflow. I tried looking at some of the already existing questions, but I could not see where I was messing up. Sorry in advance for the repeated question.
I am trying to ...
1
vote
0
answers
388
views
How to log all stdin, stdout and std err from InteractiveConsole in Python 3.7?
I am trying to copy all stdio to a logfile. I have tried the solution presented in this question because the question is similar to mine:
How to log everything that occurs in a Python interactive ...
0
votes
1
answer
64
views
Reading a web form's name/value pairs in Python
I am collecting data on a web form and using AJAX to send the name/value pairs to a python script.
<form id="myForm">
Name: <input type="text" name="uName">&...
-1
votes
1
answer
321
views
How to convert input stdin to list data structure in python [closed]
I have a stdin data in this format:
100
85 92
292 42
88 33
500
350 36
800 45
0
I want something like this [[100, [85, 92], [292, 42], [88, 33]], [500, [350, 36], [800, 45], [0]]