Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom syntax highlighting theme has been removed / Spyder crashes when a custom syntax highlighting theme has as color an invalid hex value #22970

Closed
paul18frr opened this issue Nov 13, 2024 · 7 comments · Fixed by #23524

Comments

@paul18frr
Copy link

paul18frr commented Nov 13, 2024

Hi

I noticed that my personal (dark) theme was recently removed (maybe after an update) ; twice, i tried to re-create my theme:

  1. new values don't change anything
  2. when spyder is closed and reopened, the window immediatly closes when it appears
  3. when using the anaconda prompt to launch spyder, no message is displayed

I needed to reset and return to default settings to use Spyder

Paul

  • Spyder version: 6.0.2 (conda)
  • Python version: 3.11.10 64-bit
  • Qt version: 5.15.2
  • PyQt5 version: 5.15.10
  • Operating System: Windows-10-10.0.19045-SP0
@ccordoba12
Copy link
Member

Hey @paul18frr, thanks for reporting. You said:

I noticed that my personal (dark) theme was recently removed (maybe after an update)

That probably happened when you updated from Spyder 5 to 6 because we had to reset several default theme colors.

twice, i tried to re-create my theme:

  1. new values don't change anything
  2. when spyder is closed and reopened, the window immediatly closes when it appears
  3. when using the anaconda prompt to launch spyder, no message is displayed

So, when after you set your own theme, Spyder crashes at startup?

@paul18frr
Copy link
Author

So, when after you set your own theme, Spyder crashes at startup?

Yep

@ccordoba12
Copy link
Member

@dalthviz, could you check if you're able to reproduce this problem on Windows? Thanks!

@dalthviz
Copy link
Member

dalthviz commented Nov 13, 2024

@paul18frr could it be possible for you to run spyder in debug mode and check if any output related with the error is registered? For that, use an Anaconda Prompt with the env you have Spyder installed activated and try launching with something like spyder --debug-info verbose. Also, what values are you using for your custom theme? How are you setting such values? Could it be possible for you to create a GIF/video showing the behavior you are experiencing?

Any further info in order to reproduce and better understand this is greatly appreciate! Let us know!

@paul18frr
Copy link
Author

Well, I cannot explain what I did wrong yesterday, because it works now => i've probably implemented wrong values (when typing, sometimes an extra character appeared like a bullet or a spade one during my trials :-) ... I may forgot to remove one ?!? ).

Here after my theme which is no more no less than the original Spyder theme i'm using for years (actually since I started to play with the IDE :-)

So sorry for the post

myTheme

@ccordoba12
Copy link
Member

i've probably implemented wrong values (when typing, sometimes an extra character appeared like a bullet or a spade one during my trials :-)

This is very important information! I guess if any of the colors entered by users in their custom color scheme is not a valid hex color, then Spyder would crash in the way you described.

@dalthviz, could you check if you're able to reproduce that on your side?

So sorry for the post

No worries! I think you revealed to us a critical error that we really need to fix.

@dalthviz
Copy link
Member

Thank you for the new info @paul18frr ! Adding a ! to one of the colors of an scheme, I was able to reproduce crashing Spyder after it is relaunched. Checking, from a dev version I was able to get the following traceback:

Traceback (most recent call last):
  File "E:\Acer\Documentos\Spyder\spyder\bootstrap.py", line 214, in <module>
    start.main()
  File "E:\Acer\Documentos\Spyder\spyder\spyder\app\start.py", line 285, in main
    mainwindow.main(options, args)
  File "E:\Acer\Documentos\Spyder\spyder\spyder\app\mainwindow.py", line 1425, in main
    mainwindow = create_window(MainWindow, app, splash, options, args)
  File "E:\Acer\Documentos\Spyder\spyder\spyder\app\utils.py", line 370, in create_window
    main.post_visible_setup()
  File "E:\Acer\Documentos\Spyder\spyder\spyder\app\mainwindow.py", line 861, in post_visible_setup
    plugin.on_mainwindow_visible()
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\plugin.py", line 562, in on_mainwindow_visible
    self.create_new_client(give_focus=False)
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\plugin.py", line 687, in create_new_client
    self.get_widget().create_new_client(
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\widgets\main_widget.py", line 1696, in create_new_client
    client = ClientWidget(
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\widgets\client.py", line 148, in __init__
    self.shellwidget = ShellWidget(
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\widgets\shell.py", line 167, in __init__
    super().__init__(*args, **kw)
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\widgets\debugging.py", line 206, in __init__
    super(DebuggingWidget, self).__init__(*args, **kwargs)
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\widgets\debugging.py", line 85, in __init__
    super(DebuggingHistoryWidget, self).__init__(*args, **kwargs)
  File "e:\acer\documentos\spyder\spyder\external-deps\qtconsole\qtconsole\rich_jupyter_widget.py", line 71, in __init__
    super().__init__(*args, **kw)
  File "e:\acer\documentos\spyder\spyder\external-deps\qtconsole\qtconsole\jupyter_widget.py", line 129, in __init__
    self._syntax_style_changed()
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\widgets\shell.py", line 1439, in _syntax_style_changed
    self._highlighter._style = create_style_class(self.syntax_style)
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\utils\style.py", line 171, in create_style_class
    class StyleClass(Style):
  File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\site-packages\pygments\style.py", line 122, in __new__
    ndef[0] = colorformat(styledef)
  File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\site-packages\pygments\style.py", line 79, in colorformat
    assert False, f"wrong color format {text!r}"
AssertionError: wrong color format '#b0e686!'

@dalthviz dalthviz changed the title Own theme has been eremoved / Spyder closes when it is implemented Custom color syntax theme has been removed / Spyder crashes when a custom color syntax theme has invalid hex values Nov 14, 2024
@dalthviz dalthviz changed the title Custom color syntax theme has been removed / Spyder crashes when a custom color syntax theme has invalid hex values Custom syntax highlighting theme has been removed / Spyder crashes when a custom syntax higlighting theme has as color an invalid hex value Nov 14, 2024
@dalthviz dalthviz changed the title Custom syntax highlighting theme has been removed / Spyder crashes when a custom syntax higlighting theme has as color an invalid hex value Custom syntax highlighting theme has been removed / Spyder crashes when a custom syntax highlighting theme has as color an invalid hex value Nov 14, 2024
@ccordoba12 ccordoba12 added this to the v6.0.4 milestone Nov 14, 2024
@ccordoba12 ccordoba12 assigned jsbautista and unassigned ccordoba12 and dalthviz Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment