165 questions
-1
votes
1
answer
60
views
Unable to read output from interactive script in python subprocess.Popen
The following program is used to simulate cmd.exe using subprocess.
import subprocess
import sys
import threading
def handle_output(shell):
while shell:
output = shell.stdout.readline(1)
...
0
votes
1
answer
59
views
What is VSCode setting to send output from code executed to interactive window instead of terminal?
looking to move away from Jupyter Notebook and seen interactive window in VSCode. However selecting code and then pressing shift+enter sends execution output to terminal, not interactive window.
Added ...
3
votes
2
answers
1k
views
Unresponsive Python interactive window in Visual Studio 2022
I have installed the Python development workload in Visual Studio 2022.
When I try to execute 2+2 in the interactive window, there is no result and I only see the waiting mouse cursor.
Is this ...
4
votes
1
answer
349
views
Python 3.13 REPL with vim or emacs key bindings?
I just upgraded to Python 3.13 and found that the vim key bindings that I had set up via readline and ~/.editrc, which worked in previous releases of the Python REPL, no longer work. Is there some way ...
0
votes
1
answer
351
views
Why does VS Code require the Jupyter extension to run Python interactively, even for .py files?
I've noticed that when trying to run Python code interactively in VS Code (e.g., executing code cells in .py files), VS Code prompts me to install the Jupyter extension.
This seems strange because I ...
0
votes
1
answer
35
views
Python imports & interactive window
I am struggling with imports in Python.
Currently, this is my file structure:
.
├── my_project
│ ├── helpers
│ │ ├── SomeHelper.py
│ │ └── __init__.py
│ ├── CalculateStuff
│ │ ├── ...
0
votes
0
answers
211
views
Efficient Python for Data Science Interactive setup with VSCode with Remote Development?
For the past two years I've been iterating my development setup. My use case for Python is data science and machine learning, meaning the Jupyter Notebook was my first choice and my primary need is to ...
0
votes
0
answers
195
views
Jupyter Notebooks in VS Code No Longer Recognize Working Directory—Why?
Starting this week, my Jupyter notebooks in VS Code have stopped recognizing the working directory correctly. Previously, everything worked as expected without any manual configuration.
When I run a ...
0
votes
1
answer
499
views
Having Error 200 in my Python code connecting it to Interactive Brokers
I am trying to scan some options and get a ton of Error 200 and strikes that do not even exist. Such as TSLA Strike 177.33!!! Any idea how to overcome this? Thank you.
def init_contract(symbol):
...
1
vote
0
answers
212
views
Jupyter Lab 4.x and ipywidgets
I am currently working in JupyterLab version 4.1.6 and having problems with sliders from ipywidgets (version 8.1.2). I wanted to display 2D slices from a 3D image, where the slider would control the ...
0
votes
1
answer
87
views
How to configure VS Code interactive window workingdirectory to a script in a subfolder?
My project is organized as follow:
├── data
│ ├── processed # The final data sets for modeling
│ └── raw # The original data files.
├── src ...
0
votes
0
answers
228
views
Google Colab: On-click interactive plots not working
I'm trying to use this snippet, which works as intended locally, in Google Colab. The snippet basically set to NaN a pixel value on click. Google Colab does show correctly the image but if I click on ...
0
votes
1
answer
84
views
How to change cell value alignment in ipysheet sheet from a pandas dataframe
how can i change the alignment of an entire column or an individual cell in ipysheet ?
I tried :
for k,c in enumerate(sheet1.cells):
c.style['textAlign']='left'
but it doesnt work (might be ...
1
vote
1
answer
145
views
Altair - plot on background image
I would like to display an image and plot markers on it. However, the image does not appear to align with the axis well, resulting in the markers in wrong places. Here is my code:
import altair as alt
...
0
votes
2
answers
385
views
Pressing Escape in VS Code Interactive (IPython) deletes the cell. How can I disable this?
I normally write code in a python script (.py-file) divided into cells (with # %%) and execute the cells or single lines of code in an interactive window to the right of the script.
The interactive ...
0
votes
0
answers
22
views
Clearing an interactive animated plot
I have the following simple exmample of animation across subplots and now I am trying to make it interactive. When I changes the parameters via interaction I have know it is calling run because my ...
-1
votes
1
answer
198
views
Broken HTML links in Python error output in Interactive Windows and Notebook outputs in VS Code (circa VS Code 1.84)
After the recent update of vscode my error messages in the python interactive window started to look like this:
File c:\Users\user\anaconda3\lib\site-packages\pandas\core\internals\construction.py:845,...
0
votes
0
answers
270
views
Python Interactive Jupyter notebooks (".py") to HTML straight conversion
Is there any way to directly convert the ".py" files with cells as outlined here (https://code.visualstudio.com/docs/python/jupyter-support-py) to HTML?
Currently, I can first convert the &...
0
votes
1
answer
367
views
Plot x value after a mouse click in Plotly
I would like to create a candle simulator where the next value is plotted after an event (mouse click or timer).
Instead of showing the whole plot, unshadow the next value on demand (aka append a new ...
1
vote
0
answers
197
views
How can I customize hvplot plotted from an interactive object?
I am trying to make interactive dashboards from my data. I use panel. I have tha scatter hvplot below and I want to add customization, like VSpan or VLine elements. My problem is I am working with ...
0
votes
1
answer
348
views
How to hide >>> prompt in python3 interactive console? Is there a flag for this?
For copy and paste purposes, I wish to hide the >>> and ... Python prompts whenever I am in the interactive shell console. I have achieved this effect successfully with the command import sys,...
1
vote
1
answer
889
views
plotly error: ValueError: The data property of a figure may only be assigned a list or tuple that contains a permutation of a subset of itself
I am simulating some data and trying to plot various samples of it using plotly and ipythonwidgets. I created dropdowns to let people choose the sample size and the number of samples that they want to ...
2
votes
0
answers
2k
views
neovim: pwntools process automatically stops when trying to invoke interactive shell
I'm using python pwntools.
I'm using python 3.10.x
This line of code should open a shell for me:
io.interactive()
But while running this file from vim using
!./% it doesn't open the shell doesn't ...
1
vote
2
answers
2k
views
How to close an open trade using API of Interactive brokers
everyone
I'm trying to write a little code using the Interactive brokers API
I opened a trade using the API of Interactive brokers and now let's say after it is profitable I want to sell it
What code ...
0
votes
1
answer
484
views
Separate range sliders for multiple y axes in bokeh
I have multiple line plots to draw on a single figure and I am doing this using bokeh.plotting. Using
p0.line(),
p0.extra_y_ranges(),
and
p0.add_layout(LinearAxes())
p0 being 1 bokeh figure.
I ...
0
votes
0
answers
195
views
How to input commands into Python InteractiveConsole when opened in Gitlab Runner
I am trying to perform an operation in Gitlab Runner using Python's InteractiveConsole. Below is the test case that I'm trying to implement. The last two lines of the before_script segment is what I ...
0
votes
1
answer
103
views
Get the current session history only for Python interactive session?
This question is specific to using the python -i command (not IPython): how can I limit the exported history to commands from the current session only?
Specifically, when I run Python via terminal (...
1
vote
1
answer
163
views
Weird behaviors on interactive imshow plot in Python
I'm trying to construct a grid of black squares, and everytime you click on one it turns white. Now for some reason my code does very weird things:
The coordinates I input doesn't correspond to the ...
0
votes
1
answer
1k
views
Get Input in Python Interactive Mode
Say I have a simple script that depends on my input:
w = input()
print(f'Input is {w}')
If I copy and paste this script (both lines at the same time) into the interactive window, it won't pause on ...
1
vote
3
answers
1k
views
Failed to start the Kernel. OSError: [WinError 123]
Since a few days I can't run my code (not even a simple print("Hello wolrd")) file in my python interactive window anymore. When I try to start the kernel I get the following message:
...
1
vote
0
answers
206
views
Automatic quit of a python program in interactive mode
I'm writing a python (v. 3.9) program intended to be run in interactive mode. Program needs an argument to run properly. So, I try to check if the argument is present or if it is not in order to ...
1
vote
0
answers
552
views
Visual Studio - Execute Project in Python Interactive - Not working
In Visual Studio I'm trying to execute my script in the Interactive Window (Ctrl+Shift+F5), however I get either one of the following error messages (depending on whether I executed commands in the ...
0
votes
1
answer
394
views
Python interactive mode command line editing broken
I have python3.10 on CentOS and command line editing and history recall doesn't work within the interactive python shell. (It does in python2 which is also installed as it is necessary for lots of ...
1
vote
1
answer
432
views
Dynamically change the coordinates and the text of annotation with slider in Bokeh plot
I have a Bokeh plot in which I have a slider. I want to change the coordinates of the line drawn with the slider, as shown in the screenshot of the figure. When I change the slider, the line changes ...
0
votes
1
answer
1k
views
Matplotlib not clearing old plots when updating figure
I have a code to plot points and to update the number of points in X,Y with a slider.
There is no way I can make the old plots disappear in the update function, tried all possible variations of .clear(...
0
votes
2
answers
1k
views
Plotly interactive visualizations dropdown
I am attempting to create a plotly dash drop-down whose selection is used to filter a dataframe and generate a pie chart from the filtered dataframe. I started with the working code from plotly ...
1
vote
0
answers
339
views
PyQt5 window not showing properly in pycharm interactive console
I can't run qt interactively in pycharm 2021.3.2, which is quite annoying.
For example, if I run in the pycharm console:
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
app = QApplication([])
...
0
votes
0
answers
491
views
Make "Arrow Up" button in interactive python mode continue from where it left off
Problem
When I was using Windows, the "Arrow Up" button would continue where it left off in the Python REPL in the terminal, meaning: say I wrote lines l_1, l_2, l_3, l_4 in that order. Then ...
2
votes
1
answer
3k
views
Is there a setting that effects #region #endregion collapsing for Python VSCode?
Last night the #region and #endregion were working fine in VSCode for .py (python) interactive notebook files. Today, the gutter (carrot left of #region) has disappeared ctrl+k,ctrl+0 no longer ...
0
votes
2
answers
3k
views
How to use Python Interactive Window in VS Code with functions
I am new to using the python interactive window and I like it but it seems to clear local variables in between runs, so if I run something like
def main():
dates = '2012152'
# %%
print(...
2
votes
0
answers
3k
views
VSCode python interactive window: fix nvidia gpu support for tensorflow / pytorch
I just want to give you the solution for my problem as it took me quite some time to solve it and like always, the solution was very simple.
It also addresses this github issue which was closed ...
2
votes
2
answers
5k
views
click event on network's node using pyvis on jupyter lab
I am working on a project in applied data analysis and was trying to add a click event to some precise nodes in the network G. I found some poor documentation on this topic and tried to implement this ...
2
votes
1
answer
6k
views
VSCode Python Interactive Window, variable explorer
I want a Spyder-like Console in VSCode for python, so I run code in Interactive Window and click vairables as other answers said. However, instead of editor area, the jupyter variables shows in the ...
0
votes
0
answers
83
views
Python "help()" displays using "more" instead of "less" in Anaconda Prompt
I am using Anaconda Prompt (using Windows 10) at my work environment and when I type help(str), it displays the help text using more and I can only navigate the message down page by page.
However at ...
2
votes
0
answers
308
views
VSCode Version 1.60.0 Changed Interactive View to Epilepsy -- Old or Web view available?
Is there a way to revert back to the older versions Interactive View, or any Interactive view options I should be aware of? I work with python in interactive notebooks and the recent update in the ...
0
votes
0
answers
234
views
Interactive chart - Move a line to the position I need - Python
I need to create interactive chart, on which a line can be slided right/left on x axis while saving new values.
Illustration:
I have the right red line in the A position but want to move it to B ...
1
vote
0
answers
678
views
How to create an interactive heatmap with Python?
I'm trying to create an interactive Heatmap in Jupyter :
I want to be able to display a graph when double-clicking on the different cells. For instance when clicking on the cell corresponding to ...
1
vote
1
answer
5k
views
Pylance "Invalid Character in token" for !pip commands
I am running Python 3.9.5 in interactive mode on VSCode. My first cell looks like this:
The error is
Invalid character in token "" Pylance
.
The code still runs fine when I press Run Cell....
0
votes
1
answer
237
views
Matplotlib Polygon contains_point inside class not working
I'm modifying the poly_editor of matplolib here and I need to verify if some points are inside the polygon. I put a print of poly.contains_point((x,y)) when the poly is created in the main and inside ...
0
votes
1
answer
693
views
How to switch between images in interactive way in Jupyter Notebook
If I write the following in my Jupyter Notebook Markdown cell, I get to see an image saved in my "Images" folder
<img src="Images/T1.png">
However, I want to switch between ...