Skip to content

Commit 13d76fb

Browse files
committed
Fix issue #121 and #123
1 parent d529ce2 commit 13d76fb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

matlab_kernel/kernel.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def _matlab(self):
9090
self._validated_plot_settings["size"] = tuple(
9191
self._matlab.get(0., "defaultfigureposition")[0][2:])
9292
self.handle_plot_settings()
93+
return self.__matlab
9394

9495
def do_execute_direct(self, code):
9596
if pipes:
@@ -248,14 +249,15 @@ def do_shutdown(self, restart):
248249

249250
def _execute_async(self, code):
250251
try:
251-
with pipes(stdout=_PseudoStream(partial(self.Print, end="")),
252-
stderr=_PseudoStream(partial(self.Error, end=""))):
252+
with pipes(stdout=_PseudoStream(partial(self.Print, sep="", end="")),
253+
stderr=_PseudoStream(partial(self.Error, sep="", end=""))):
253254
kwargs = { 'nargout': 0, 'async': True }
254255
future = self._matlab.eval(code, **kwargs)
255256
future.result()
256257
except (SyntaxError, MatlabExecutionError, KeyboardInterrupt) as exc:
257-
stdout = exc.args[0]
258-
return ExceptionWrapper("Error", -1, stdout)
258+
pass
259+
#stdout = exc.args[0]
260+
#return ExceptionWrapper("Error", "-1", stdout)
259261

260262
def _execute_sync(self, code):
261263
out = StringIO()
@@ -267,7 +269,7 @@ def _execute_sync(self, code):
267269
except (SyntaxError, MatlabExecutionError) as exc:
268270
stdout = exc.args[0]
269271
self.Error(stdout)
270-
return ExceptionWrapper("Error", -1, stdout)
272+
return ExceptionWrapper("Error", "-1", stdout)
271273
stdout = out.getvalue()
272274
self.Print(stdout)
273275

0 commit comments

Comments
 (0)