SasView / sasview

Code for the SasView application.
BSD 3-Clause "New" or "Revised" License
50 stars 41 forks source link

Python console isn't working in new beta #2903

Closed XaelShan closed 2 months ago

XaelShan commented 3 months ago

Describe the bug In the 6.0.0 Beta, the python shell/editor isn't able to open. An error code "ERROR: Traceback (most recent call last): File "sas\qtgui\MainWindow\GuiManager.py", line 1055, in actionPython_Shell_Editor File "sas\qtgui\Utilities\IPythonWidget.py", line 36, in init File "qtconsole\base_frontend_mixin.py", line 64, in kernel_client File "qtconsole\jupyter_widget.py", line 323, in _started_channels File "ipykernel\inprocess\client.py", line 160, in kernel_info File "ipykernel\inprocess\client.py", line 195, in _dispatch_to_kernel File "jupyter_core\utils__init__.py", line 165, in wrapped File "asyncio\base_events.py", line 654, in run_until_complete File "ipykernel\kernelbase.py", line 449, in dispatch_shell AttributeError: 'NoneType' object has no attribute 'flush'"

Theorized to be due to the new cli.py file created for 6.0.0 beta, cli.py is the one that sets up console + passes args (which would then return None).

To Reproduce Steps to reproduce the behavior:

  1. Go to tools
  2. Click on Python Shell/Editor
  3. See error

Expected behavior Should open up the jupyter widget as a side panel.

Screenshots image

SasView version (please complete the following information):

Operating system (please complete the following information):

Additional context N/A

lucas-wilkins commented 3 months ago

Seems to work fine from my dev environment, through both run.py and sasview.py

wpotrzebowski commented 3 months ago

It seems to work fine from installer on Mac

XaelShan commented 3 months ago

Seems to work fine from my dev environment, through both run.py and sasview.py

For me, it also works in run.py and sasview.py, but on windows OS, the shell doesn't like to open

krzywon commented 2 months ago

This is related to sas.system.console. This is monkey-patching std{in|out|err}. Some of them end up being None, so when trying to flush them, the resulting error is thrown.

I added the console option to the executable in https://github.com/SasView/sasview/tree/2903-ipython-console that created the executable in https://github.com/SasView/sasview/actions/runs/9863865110. The SasView python console works again in the installer, but an extra console window opens when SasView launches. I am still working on this and should have a PR soon.

butlerpd commented 2 months ago

This has been merged into release_6.0.0 so closing the issue.