Skip to content

Commit 9910dde

Browse files
author
y-p
committed
Merge pull request #6250 from y-p/PR_ipython_directive
fix ipython directive, py3 and recent ipython changes
2 parents 092914a + 0773161 commit 9910dde

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

doc/source/conf.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import sys
1414
import os
1515
import re
16-
from pandas.compat import u
16+
from pandas.compat import u, PY3
1717

1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the
@@ -78,7 +78,10 @@
7878
if ds:
7979
print("I'm about to DELETE the following:\n%s\n" % list(sorted(ds)))
8080
sys.stdout.write("WARNING: I'd like to delete those to speed up processing (yes/no)? ")
81-
answer = raw_input()
81+
if PY3:
82+
answer = input()
83+
else:
84+
answer = raw_input()
8285

8386
if answer.lower().strip() in ('y','yes'):
8487
for f in ds:

doc/sphinxext/ipython_directive.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,11 @@ def process_input_line(self, line, store_history=True):
344344
splitter.push(line)
345345
more = splitter.push_accepts_more()
346346
if not more:
347-
source_raw = splitter.source_raw_reset()[1]
347+
try:
348+
source_raw = splitter.source_raw_reset()[1]
349+
except:
350+
# recent ipython #4504
351+
source_raw = splitter.raw_reset()
348352
self.IP.run_cell(source_raw, store_history=store_history)
349353
finally:
350354
sys.stdout = stdout

0 commit comments

Comments
 (0)