Skip to main content

All Questions

Tagged with
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&...
pipsqueaker117's user avatar
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 ...
Vovin's user avatar
  • 750
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() ...
shai simchon's user avatar
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("...
user8845408's user avatar
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 ...
tschutter's user avatar
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 ...
niico's user avatar
  • 57
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) ...
Deepak Rajput's user avatar
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....
MrStan12's user avatar
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....
MangHatDa's user avatar
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 ...
Daddy's user avatar
  • 9,035
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 ...
flyoylf's user avatar
  • 11
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 ...
That One Guy's user avatar
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 ...
user46809's user avatar
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">&...
Shawn's user avatar
  • 3,109
-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]]
Richard G's user avatar

15 30 50 per page
1
2 3 4 5
8