A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ipython/ipython/issues/9775 below:

%load's automatic comment line causes IndentationError · Issue #9775 · ipython/ipython · GitHub

I started using %load a lot for interactive work. An issue is that it automatically adds a comment line on the top of the loaded script, which can cause IndentationError when the loaded script is indented. Hence I have to scroll all the way to the top and delete the comment line for it to work. For example, with the following test_load.py file:

import os

if __name__ == '__main__':
    print(1)
In [12]: %load -r 4: ./test_load.py

In [13]: # %load -r 4: ./test_load.py
    ...:     print(1)
    ...:     
    ...: 
  File "<ipython-input-13-126c9c2d676e>", line 2
    print(1)
    ^
IndentationError: unexpected indent

It would be great if there is a way either to exclude this line, automatically indent the comment line, or automatically unindent the actual code so it will run without any user input.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4