Skip to content

Commit bb35bb8

Browse files
committed
added wurlitzer as a dependency
1 parent 4c6c566 commit bb35bb8

File tree

3 files changed

+6
-185
lines changed

3 files changed

+6
-185
lines changed

matlab_kernel/kernel.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@
1818

1919
from IPython.display import Image
2020
from metakernel import MetaKernel, ExceptionWrapper
21+
from wurlitzer import pipes
2122

2223
from . import __version__
2324

24-
try:
25-
from .wurlitzer import Wurlitzer
26-
except ImportError:
27-
Wurlitzer = None
28-
2925

3026
class _PseudoStream:
3127

@@ -88,10 +84,7 @@ def do_execute_direct(self, code):
8884
self._matlab.get(0., "defaultfigureposition")[0][2:])
8985
self.handle_plot_settings()
9086

91-
if Wurlitzer:
92-
retval = self._execute_async(code)
93-
else:
94-
retval = self._execute_sync(code)
87+
retval = self._execute_async(code)
9588

9689
settings = self._validated_plot_settings
9790
if settings["backend"] == "inline":
@@ -245,8 +238,8 @@ def do_shutdown(self, restart):
245238

246239
def _execute_async(self, code):
247240
try:
248-
with Wurlitzer(_PseudoStream(partial(self.Print, end="")),
249-
_PseudoStream(partial(self.Error, end=""))):
241+
with pipes(stdout=_PseudoStream(partial(self.Print, end="")),
242+
stderr=_PseudoStream(partial(self.Error, end=""))):
250243
future = self._matlab.eval(code, nargout=0, async=True)
251244
future.result()
252245
except (SyntaxError, MatlabExecutionError, KeyboardInterrupt) as exc:

matlab_kernel/wurlitzer.py

-173
This file was deleted.

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@
3939
"ipython (>=4.0.0)"],
4040
install_requires=["metakernel>=0.20.8", "jupyter_client >=4.4.0",
4141
"ipython>=4.0.0",
42-
"backports.tempfile;python_version<'3.0'"]
42+
"backports.tempfile;python_version<'3.0'",
43+
"wurlitzer>=1.0.2"]
4344
)

0 commit comments

Comments
 (0)