Questions tagged [python-interactive]
158 questions
0
votes
1 answer
Interactive Slider Bar Chart Color Control
I have four sets of random normal distributed numbers. The means are used to plot bar chart with each set's 95% confidence intervals plotted with errorbar.
Given a value y, four different colors will be set to the bars corresponding to the four…

Darth BEHFANS
- 409
- 6
- 10
0
votes
3 answers
Improper indentation allowed in Python IDLE?
While looking at an answer given by wwii, I commented on his indentation saying it was wrong. However, after running his code in my IDLE, I discovered that it ran without a hitch.
I tried a few examples, just to make sure I was getting correct…

Christian Dean
- 22,138
- 7
- 54
- 87
0
votes
1 answer
Run Python process in background with interactive shell on the same memory
I'm not sure if this is the right way to word this, but I have a python web server that accepts connections and updates objects, is it possible to use the interactive shell to inject commands into the same memory space and view/change the objects…

Troy Fletcher
- 58
- 4
0
votes
0 answers
Is this possible to modify python packages with python shell?
Let’s say I have a python package like this :
my-python-package/
__init__.py
app.py
__init__.py is empty and it is just for telling python that we have a python package. And app.py is this :
FAVORITE_COLORS = ['blue', 'purple']
Here is the…

Uncle
- 133
- 1
- 10
0
votes
2 answers
Devise an experiment that compares the performance of the del operator on lists and dictionaries
I'm currently doing Problem Solving with Algorithms and Data Structures
So here I'm on programming exercise on 3rd question as it says Devise an experiment that compares the performance of the del operator on lists and dictionaries.
Here is the…
user6109137
0
votes
1 answer
Cancel a "..." continuation block in Python interpreter
I often find myself in a situation like this:
>>> for line in infile.readlines():
... line = line.rtrim()
... line█ # ^^^^^ Oops, mistake!
At this point I want to start again (because I mixed up the "trim" from Java with the "strip" from…

Evgeni Sergeev
- 22,495
- 17
- 107
- 124
0
votes
1 answer
Python3 interactive mode on Linux launches the codes twice
I have written a chess program in Python 3.4.3 and I am running the Python 3 interpreter in the interactive mode as follows:
python3 -i chess.py
However, the code after the class definitions get invoked twice and I do not know why. My code is on…

Vesnog
- 773
- 2
- 16
- 33
0
votes
3 answers
python "up-button" command completion, matlab/julia style
I recently switched from Matlab to Numpy and love it. However, one really great thing I liked about Matlab was the ability to complete commands. There are two ways that it does this:
1) tab completion. If I have a function called foobar(...), I can…

xdavidliu
- 2,411
- 14
- 33
0
votes
1 answer
Custom interactive terminal (CLI) with autocompletion on classes and objects
I would like to have an interactive prompt similar to IPython within a program.
The features I would like to have are:
Custom prompt
Auto-completion on object's methods and attributes
Execution of methods, read/write attributes
Display docstring…

nowox
- 25,978
- 39
- 143
- 293
0
votes
1 answer
Suppress warnings on import?
Assuming I write a python package that has to use the imp module, and my package is "TestModule" which is the following:
import imp
import pip
import sys
def update_and_reload(module, *args, **kwargs):
pip.main(['install', module, '--upgrade',…

13steinj
- 427
- 2
- 9
- 16
0
votes
1 answer
Is it possible to make Python interpret a script line by line and generate output as if from an interactive shell?
Considering the following interactive shell session.
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+1
2
>>> 2+5
7
>>> "foo"
'foo'
>>>
Observe how,…

merlin2011
- 71,677
- 44
- 195
- 329
0
votes
0 answers
Terminate compound statements in IPython
I am new to python (and programming), so please forgive me if I don't follow the correct nomenclature. It makes finding answers to even the most trivial questions hard. Thanks!
In IPython I typed the following:
for i in s:
print([s:i]
The white…

DigitalMusicology
- 251
- 1
- 5
- 14
0
votes
2 answers
In the Python interactive interpreter, is there any way to refer to the results of the last command?
When I'm using the Python interactive interpreter, I frequently find myself doing this:
>>> a = "starting value"
>>> foo(a)
"something I don't want"
>>> bar(a)
"what I wanted"
>>> a = bar(a)
Is there any way to just do:
>>> bar(a)
"what I…

Ahto
- 1
- 1
0
votes
1 answer
python: load thrift classes and run interactive shell
In django framework you may run
./manage.py shell
and you'll be inside interactive shell with django settings. I can run a python interactive console using
#!/usr/bin/env python
import code
code.interact(local=locals())
I want to do the same as…

ducin
- 25,621
- 41
- 157
- 256
0
votes
3 answers
os x 10.6.8 - Cannot input non-ASCII/UTF-8 chars (e.g: å, ä, ö) in Python Interactive Mode
Running OS X 10.6.8 Snow Leopard I cannot input the scandinavian letters into the interpretive mode. The terminal bell sounds for every keystroke and nothing shows up. All letters show up as normal in the regular terminal environment. Inputting UTF8…

Parham
- 3,157
- 4
- 31
- 44