Python Forum
ipython autocomplete broke indentation!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ipython autocomplete broke indentation!
#1
I installed ipython through the pip in order to use autocomplete, and now indentation doesn't work in the regular Python shell (it does still work in ipython, though):

>>> def f(): ... pass File "<stdin>", line 2 pass ^ IndentationError: expected an indented block
Reply
#2
I don't understand, you didn't indent pass.

>>> def f(): ... pass File "<stdin>", line 2 pass ^ IndentationError: expected an indented block >>> def f(): ... pass ... >>>
That't the behavior I've always seen from the Python shell.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
(Apr-07-2019, 11:14 PM)ichabod801 Wrote: I don't understand, you didn't indent pass.

I shouldn't have to indent it manually; that's what the three dots do (or did, before I installed ipython). But when I hit the Tab button to manually indent it, I still get the indentation error:

Microsoft Windows [Version 10.0.17134.648] (c) 2018 Microsoft Corporation. All rights reserved. C:\Users\Exsul>python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> def f(): ... Readline internal error Traceback (most recent call last): File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\site-packages\pyreadline\console\console.py", line 768, in hook_wrapper_23 res = ensure_str(readline_hook(prompt)) File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\site-packages\pyreadline\rlmain.py", line 571, in readline self._readline_from_keyboard() File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\site-packages\pyreadline\rlmain.py", line 536, in _readline_from_keyboard if self._readline_from_keyboard_poll(): File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\site-packages\pyreadline\rlmain.py", line 556, in _readline_from_keyboard_poll result = self.mode.process_keyevent(event.keyinfo) File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\site-packages\pyreadline\modes\emacs.py", line 243, in process_keyevent r = self.process_keyevent_queue[-1](keyinfo) File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\site-packages\pyreadline\modes\emacs.py", line 286, in _process_keyevent r = dispatch_func(keyinfo) File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\site-packages\pyreadline\modes\basemode.py", line 257, in complete completions = self._get_completions() File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\site-packages\pyreadline\modes\basemode.py", line 200, in _get_completions r = self.completer(ensure_unicode(text), i) File "C:\Users\Exsul\AppData\Local\Programs\Python\Python37\lib\rlcompleter.py", line 80, in complete readline.redisplay() AttributeError: module 'readline' has no attribute 'redisplay' File "<stdin>", line 2 ^ IndentationError: expected an indented block >>>
Reply
#4
Correction: The problem is that I can't indent, because it tries to autocomplete instead.
Reply
#5
if you are using any ide, just do ctrl+A and format the code to auto indentation.

If you are using select all the source code block and select source on menu tab and click on fix indentation, your problem will be solved.
Reply
#6
(Apr-07-2019, 11:39 PM)Exsul Wrote: I shouldn't have to indent it manually; that's what the three dots do (or did, before I installed ipython).
That's because you never run ipython.
Exsul Wrote:C:\Users\Exsul>python
This start the normal build in interpreter where you have to manually indent.
Start with ipython.
Here python | IPYthon | ptpython(what i use).
Use also cmder it's an whole other class that cmd/powershell rubbish,then get nice color as shown in image under.
[Image: 94RUKM.png]
Reply
#7
I uninstalled iPython and cleaned the registry, but Tab still won't indent.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Sad Selenium update broke python code genericusername12414 1 1,275 Mar-16-2024, 07:33 PM
Last Post: snippsat
  IPython errors for numpy array min/max methods muelaner 1 2,035 Nov-04-2023, 09:22 PM
Last Post: snippsat
  Can a program execute code in iPython shell and get result? deanhystad 3 3,518 Jun-17-2022, 03:45 AM
Last Post: Larz60+
  my python intrepeter completely broke Underscore 9 7,362 Oct-12-2021, 06:57 PM
Last Post: deanhystad
  autocomplete working code sample not working... aviper4u 0 2,429 Oct-24-2020, 03:04 AM
Last Post: aviper4u
  IPython console vs Spyder script losc 3 4,398 Apr-30-2020, 04:57 AM
Last Post: deanhystad
  How can I create a multiline input in ipython? DataMower 3 6,730 Oct-28-2019, 08:50 PM
Last Post: DataMower
  How to create an autocomplete method that search an existing trie in python nanoprogrammer 0 3,899 Jul-20-2019, 12:09 AM
Last Post: nanoprogrammer
  How to clear IPython console in Spyder? Vai 7 68,251 Aug-20-2018, 09:43 PM
Last Post: james_balcomb
  Stopwatch in Python/IPython shell suvadip 3 6,002 Jul-06-2018, 01:51 PM
Last Post: snippsat

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.