Python Forum
readline.parse_and_bind() does not work in start-up script of Python interpreter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
readline.parse_and_bind() does not work in start-up script of Python interpreter
#1
I created a startup script file

import readline  
readline.parse_and_bind("set disable-completion on")  
readline.parse_and_bind("tab: self-insert")
and point environment variable PYTHONSTARTUP to it. The effect of this start-up script is that I can type Tab key as 8 space bars in the Python interpreter command line, instead of as a command of completion. Although I'm sure this start-up script is indeed executed when Python interpreter is started, the statements are not in effect. That is, when I type Tab key, the python command line still tries to complete and utters a lot of error (because there is nothing to be completed). These commands take effects only if I type them in Python command line explicitly. So, is readline.parse_and_bind() function known to not work in start-up scripts? If it is supposed to be working, how can I make it work?

PS, I am using Python 3.9.5 interpreter in miniconda3 on Windows 10. I start Python interpreter by typing "python". The above start-up script file exists and the environment variable PYTHONSTARTUP is set up properly.
Larz60+ write Jan-18-2022, 02:41 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,000 Jun-29-2023, 11:57 AM
Last Post: gologica
  Pyserial Readline() conversion to array bprosman 1 1,812 Apr-11-2023, 12:44 AM
Last Post: deanhystad
  Greek letters with .readline() and tkinter KinkgOfKeks 7 1,627 Mar-24-2023, 05:13 PM
Last Post: deanhystad
Star Pyserial not reading serial.readline fast enough while using AccelStepper on Arduino MartyTinker 4 3,857 Mar-13-2023, 04:02 PM
Last Post: deanhystad
  Start Putty into Python Form Schlazen 5 5,331 Dec-13-2022, 06:28 AM
Last Post: divya130
  Python Idle won't start totalmachine 9 3,375 Oct-16-2022, 05:57 PM
Last Post: totalmachine
  Mac default python interpreter Viewpoint8455 2 873 Oct-13-2022, 06:25 AM
Last Post: perfringo
  Python Interpreter ankitdixit 4 2,620 Jun-10-2022, 12:37 PM
Last Post: katy1234
Photo Visual studio code unable to color syntax on python interpreter tomtom 4 6,676 Mar-02-2022, 01:23 AM
Last Post: tomtom
  Make my py script work only on 1 compter tomtom 14 3,735 Feb-20-2022, 06:19 PM
Last Post: DPaul

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020