Menu

#176 TypeError: MenuItem(): argument 2 has unexpected type 'StandardID'

open
nobody
None
2023-09-11
2023-09-04
davidak
No

I tried to update the nixos package, but it produces a traceback. Is that something you have to fix?

[davidak@gaming:~/code/nixpkgs]$ /nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/bin/timeline 
Traceback (most recent call last):
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/bin/.timeline-wrapped", line 67, in <module>
    main()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/bin/.timeline-wrapped", line 63, in main
    start_wx_application()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/setup.py", line 71, in start_wx_application
    main_frame = MainFrame()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/frames/mainframe/mainframe.py", line 84, in __init__
    self._create_gui()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/frames/mainframe/mainframe.py", line 223, in _create_gui
    self._create_main_panel()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/frames/mainframe/mainframe.py", line 234, in _create_main_panel
    self._main_panel = MainPanel(self)
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/mainpanel.py", line 46, in __init__
    self._create_gui()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/mainpanel.py", line 79, in _create_gui
    self._timeline_panel = TimelinePanel(self, self._main_frame)
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/timelinepanel.py", line 63, in __init__
    TimelinePanelGuiCreator.__init__(self, parent)
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/timelinepanelguicreator.py", line 57, in __init__
    self._create_gui()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/timelinepanelguicreator.py", line 69, in _create_gui
    self._create_splitter()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/timelinepanelguicreator.py", line 102, in _create_splitter
    self._create_sidebar()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/timelinepanelguicreator.py", line 111, in _create_sidebar
    self.sidebar = Sidebar(self._main_frame, self.splitter)
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/sidebar.py", line 33, in __init__
    self._create_gui()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/sidebar.py", line 54, in _create_gui
    self.category_tree = CustomCategoryTree(self, self._main_frame.config)
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/categorytree.py", line 39, in __init__
    self._create_context_menu()
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/categorytree.py", line 210, in _create_context_menu
    add_item(
  File "/nix/store/746jyk87pkylwgimvrgn2zishfh2a4q4-timeline-2.9.0/lib/python3.10/site-packages/timelinelib/wxgui/components/categorytree.py", line 203, in add_item
    item = wx.MenuItem(self.context_menu, wx.ID_ANY, name)
TypeError: MenuItem(): argument 2 has unexpected type 'StandardID'

Here others get the same error: https://discuss.wxpython.org/t/typeerror-menuitem-argument-2-has-unexpected-type-standardid-when-running-the-demo/36464
Does this help: https://stackoverflow.com/a/40073924

Python 3.10.12
wxPython 4.2.1
humblewx 0.2.2

Discussion

  • Rickard Lindberg

    As far as I can tell, we are calling the API correctly.

    Something like in the thread linked seems possible:

    We are suspecting that somehow through the various updates to MSW and Visual Studio we end up calling an outdated DLL somehow.

    Can you play with different version of Python / wxPython / Timeline?

     
  • davidak

    davidak - 2023-09-07

    Yes.

    wxPython 4.2.1 seem to introduce this issue. Can you reproduce that?

    I don't have the issue with:

    Python 3.10.12
    wxPython 4.2.0 <-
    humblewx 0.2.2

    Issue reproducible with:

    Python 3.11.4
    wxPython 4.2.1
    humblewx 0.2.2

    Python 3.10.12
    wxPython 4.2.1
    humblewx 0.2.2

    Python 3.9.17
    wxPython 4.2.1
    humblewx 0.2.2

    Unable to test:

    Python 3.12.0b2 (meson don't build)
    Python 3.8.17 (backports-zoneinfo broken)

     
  • Rickard Lindberg

    I have now tried with the following versions:

    • Python: 3.9.10
    • wxPython: 4.2.1

    It works for me.

     
  • davidak

    davidak - 2023-09-11

    OK, then the issue seem not in the code.

    I tested with that exact version and still get the issue.

    Will debug further. Thanks!

     

Log in to post a comment.