Skip to content

Commit 012e672

Browse files
authored
Merge pull request #129 from openSUSE/toms/ipython-autoreload
Simplify autoreload IPython script
2 parents 3b8c92b + 3dc10f4 commit 012e672

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

.ipython/profile_default/startup/10-autoreload.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#
2-
try:
3-
get_ipython().run_line_magic("load_ext", "autoreload")
4-
get_ipython().run_line_magic("autoreload", "-p", "1")
1+
from IPython.core.getipython import get_ipython
2+
3+
ipython = get_ipython()
4+
5+
if ipython is not None:
6+
ipython.run_line_magic("load_ext", "autoreload")
7+
ipython.run_line_magic("autoreload", "2")
8+
59
print(" Automatically enabled autoreload")
6-
except Exception:
7-
pass # Not running inside IPython

0 commit comments

Comments
 (0)