##// END OF EJS Templates
Add an option to disable stdin
Jessica B. Hamrick -
Show More
@@ -10,7 +10,7 b' try:'
10 10 except ImportError:
11 11 from Queue import Empty # Py 2
12 12
13 from IPython.utils.traitlets import List, Unicode
13 from IPython.utils.traitlets import List, Unicode, Bool
14 14
15 15 from IPython.nbformat.v4 import output_from_msg
16 16 from .base import Preprocessor
@@ -26,6 +26,11 b' class ExecutePreprocessor(Preprocessor):'
26 26 help="The time to wait (in seconds) for output from executions."
27 27 )
28 28
29 allow_stdin = Bool(
30 False, config=True,
31 help="Whether stdin should be enabled when executing cells"
32 )
33
29 34 extra_arguments = List(Unicode)
30 35
31 36 def preprocess(self, nb, resources):
@@ -36,6 +41,7 b' class ExecutePreprocessor(Preprocessor):'
36 41 extra_arguments=self.extra_arguments,
37 42 stderr=open(os.devnull, 'w')) as kc:
38 43 self.kc = kc
44 self.kc.allow_stdin = self.allow_stdin
39 45 nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
40 46 return nb, resources
41 47
General Comments 0
You need to be logged in to leave comments. Login now