All Questions
Tagged with read-eval-print-loop python
176 questions
3
votes
2
answers
137
views
Shift+enter inserts extra indents
I have a Python source file with some dummy code:
a = 3
if a == 1:
print("a = 1")
elif a == 2:
print("a = 2")
else:
print("Other")
When I submit the code to ...
2
votes
1
answer
228
views
How to best change the colour of the Python prompt?
I have an alias for python3 and one for a Python calculator (pm for Python Math):
alias p3='python3 -q'
alias pm='python3 -qic"from math import *; import sys; sys.ps1=\"] \"; sys.ps2=\&...
5
votes
1
answer
288
views
How to paste code into the REPL without adding extra spaces on the left
I am running Python 3.13.1. When I paste code into the Python REPL, Python adds extra spaces at the beginning of every line after the first.
I wrote this code in Notepad and pasted it into Python.
if ...
0
votes
1
answer
143
views
How to resolve vscode python REPL ModuleNotFoundError
In vscode I’m encountering a ModuleNotFoundError when trying to import a module (src) located in my project workspace folder in a Python REPL. Here's the situation:
When I run:
import os
os.getcwd()
...
1
vote
1
answer
109
views
Python 3.13 REPL key-binding ctrl+arrows not working
Previously when I ran py3.12 in shell I could use ctrl + left arrow or ctrl + right arrow to move one word back or forward (skip words).
Recently I've upgraded to py3.13 and it doesn't work anymore, ...
1
vote
0
answers
36
views
Efficently saving code from Python REPL without gui
I often use REPL in my terminal to quick test simple things. With 3.13 update repl gets better and much more usefull so increased my usage but i can't easily save from repl. My current solution is ...
1
vote
1
answer
178
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
0
answers
63
views
ChatGroq with pythonrepl agent tool returning random answers
I have a document chatbot application written in Python that uses Langchain and OpenAIEmbedding to upload & chunk documents (PDF, Word, etc) into SupabaseVectorStore database table called '...
1
vote
2
answers
602
views
Is there any way to specify the type of event loop for the asyncio REPL in Python?
I'm working on some networking code in Python that uses the asyncio module and I like to use the Python REPL from -m asyncio a lot for testing examples. What I've noticed though is the default event ...
-1
votes
1
answer
65
views
Why does this code give me a syntax error?
Why does this code give me a syntax error in idle?
if I use python online, which was correct.
I was expecting an output like the second photo.
What is the problem and how can I fix it?
0
votes
2
answers
81
views
How to dedent a block in Python3 under MacOS?
I am learning Python3. It is executed on MacOS/Terminal by running python3.
I was able to execute some examples from the book "Deep Learning with Python, Second Edition", but I am stuck now ...
1
vote
2
answers
362
views
How to set Python 3.9 interactive editor to Vim mode
In Python 2.7, when I opened Python interactively
with the >>> prompts, the commands it took were Vim style. I love that.
When I use Python 3.9 it doesn't and the editor is much more ...
1
vote
1
answer
716
views
Getting pyreadline3.Readline's history working with Python 3.9
I am following this
Q&A's procedure for
accessing Python's REPL command history -- specifically at the Conda
prompt, not in an IDE.
I am using Python 3.9 installed under Anaconda on Windows 10. ...
0
votes
1
answer
797
views
In LangChain, how to restrict agent-generated code before execution in PythonREPLTool?
I am building an agent that can write and execute code with the PythonREPLTool to provide answers to questions. But I found that the agent often writes Python code that has "input()" to ...
3
votes
1
answer
78
views
Python Readline REPL Console Conficts with Gettext (underscore variable)
I'm using gettext for localization and installs the gettext() function to the global _ variable. However, the readline console I'm using for debug purposes also uses _ as a special variable to refer ...