vors / jupyter-powershell

PowerShell language kernel for Jupyter
MIT License
132 stars 26 forks source link

Fails to run with qtconsole #13

Open hansonap opened 5 years ago

hansonap commented 5 years ago

Executing jupyter qtconsole --kernel powershell results in a dialog box titled Error starting QtConsole with message box with the following error message:

Traceback (most recent call last):
  File "E:\alex.hanson\anaconda3\envs\udt_py36_dev\lib\site-packages\qtconsole\base_frontend_mixin.py", line 138, in _dispatch
    handler(msg)
  File "E:\alex.hanson\anaconda3\envs\udt_py36_dev\lib\site-packages\qtconsole\jupyter_widget.py", line 307, in _handle_kernel_info_reply
    self.kernel_banner = content.get('banner', 'test')
  File "E:\alex.hanson\anaconda3\envs\udt_py36_dev\lib\site-packages\traitlets\traitlets.py", line 585, in __set__
    self.set(obj, value)
  File "E:\alex.hanson\anaconda3\envs\udt_py36_dev\lib\site-packages\traitlets\traitlets.py", line 559, in set
    new_value = self._validate(obj, value)
  File "E:\alex.hanson\anaconda3\envs\udt_py36_dev\lib\site-packages\traitlets\traitlets.py", line 591, in _validate
    value = self.validate(obj, value)
  File "E:\alex.hanson\anaconda3\envs\udt_py36_dev\lib\site-packages\traitlets\traitlets.py", line 2054, in validate
    self.error(obj, value)
  File "E:\alex.hanson\anaconda3\envs\udt_py36_dev\lib\site-packages\traitlets\traitlets.py", line 625, in error
    raise TraitError(e)
traitlets.traitlets.TraitError: The 'kernel_banner' trait of a RichJupyterWidget instance must be a unicode string, but a value of None <class 'NoneType'> was specified.

Adding cmd line option --FrontendWidget.banner=test seems to have no effect. Although with other kernels it works just fine.

When debugging qtconsole.base_frontend_mixin.BaseFrontendMixin._dispatch, when it gets to powershell, banner is set to NoneType image image

And indeed PowerShellKernel._banner is set to None, where as IPythonKernel.banner returns self.shell.banner.

Setting PowerShellKernel._banner= '' is a workaround. However, the differences with other kernels leads me to believe there is something more at play here.

vors commented 5 years ago

Interesting, thank you for the detailed investigation. Would you like to send a PR with a workaround fix?

hansonap commented 5 years ago

For others who may come across this issue, a fix has been implemented here: https://github.com/hansonap/jupyter-powershell.git

Pull request has been initiated to merge fix into this repo.

vors commented 5 years ago

Great. Also I didn't know that qtconsole exists at all. Thank you for educating me! :)