interactive

Interactive input/output using Python

Interactive input/output using Python Question: I have a program that interacts with the user (acts like a shell), and I want to run it using the Python subprocess module interactively. That means, I want the possibility to write to standard input and immediately get the output from standard output. I tried many solutions offered here, …

Total answers: 4

Enter Interactive Mode In Python

Enter Interactive Mode In Python Question: I’m running my Python program and have a point where it would be useful to jump in and see what’s going on, and then step out again. Sort of like a temporary console mode. In Matlab, I’d use the keyboard command to do this, but I’m not sure what …

Total answers: 7

Interactive matplotlib plot with two sliders

Interactive matplotlib plot with two sliders Question: I used matplotlib to create some plot, which depends on 8 variables. I would like to study how the plot changes when I change some of them. I created some script that calls the matplotlib one and generates different snapshots that later I convert into a movie, it …

Total answers: 7

Checking for interactive shell in a Python script

Checking for interactive shell in a Python script Question: I need to determine whether the shell which invoked my Python script was in interactive mode or not. If it was in interactive mode, the program should pipe output to less(1) for easy reading. If not, it should simply print its output to stdout, to allow …

Total answers: 5

Is there an interactive graphing library for python

Is there an interactive graphing library for python Question: I’m looking for an interactive graphing library for Python. By “graph“, I meant a set of nodes connected by a set of vertices (not a plot of values over x-y axis, nor a grid of pixels). By “interactive”, I meant I can drag-and-drop the nodes around …

Total answers: 4

How to finish sys.stdin.readlines() input?

How to finish sys.stdin.readlines() input? Question: This might be a silly question, but as I can’t find an answer, I have to ask it. In interactive python I want to process a message which i get with: >>> message = sys.stdin.readlines() Everything works fine, but… how to stop it from getting an input and make …

Total answers: 6

Equivalent of Python's dir in Javascript

Equivalent of Python's dir in Javascript Question: when I write Python code from the interpreter I can type dir() to have a list of names defined in the current scope. How can achieve to have the same information, programmatically, when I develop Javascript code from a browser using an interactive console like firebug, chrome console, …

Total answers: 9

Is there a possibility to execute a Python script while being in interactive mode

Is there a possibility to execute a Python script while being in interactive mode Question: Normally you can execute a Python script for example: python myscript.py, but if you are in the interactive mode, how is it possible to execute a Python script on the filesystem? >>> exec(File) ??? It should be possible to execute …

Total answers: 6

Tell if Python is in interactive mode

Tell if Python is in interactive mode Question: In a Python script, is there any way to tell if the interpreter is in interactive mode? This would be useful so that, for instance, when you run an interactive Python session and import a module, slightly different code is executed (for example, logging is turned off). …

Total answers: 7

Read password from stdin

Read password from stdin Question: Scenario: An interactive CLI Python program, that is in need for a password. That means also, there’s no GUI solution possible. In bash I could get a password read in without re-prompting it on screen via read -s Is there something similar for Python? I.e., password = raw_input(‘Password: ‘, dont_print_statement_back_to_screen) …

Total answers: 2