jwdj / EasyABC

EasyABC
GNU General Public License v2.0
87 stars 36 forks source link

Runtime error with wxPython 4.2.1 #75

Open mausch opened 1 year ago

mausch commented 1 year ago
Traceback (most recent call last):
  File "/nix/store/s0xx7shngbbkydwbm2g0vv34rj8dzx96-easyabc-1.3.8.6/share/easyabc/easy_abc.py", line 8771, in OnInit
    self.frame = self.NewMainFrame(options)
  File "/nix/store/s0xx7shngbbkydwbm2g0vv34rj8dzx96-easyabc-1.3.8.6/share/easyabc/easy_abc.py", line 8710, in NewMainFrame
    frame = MainFrame(None, 0, self.app_dir, self.settings, options or {})
  File "/nix/store/s0xx7shngbbkydwbm2g0vv34rj8dzx96-easyabc-1.3.8.6/share/easyabc/easy_abc.py", line 3954, in __init__
    self.setup_menus()
  File "/nix/store/s0xx7shngbbkydwbm2g0vv34rj8dzx96-easyabc-1.3.8.6/share/easyabc/easy_abc.py", line 6177, in setup_menus
    append_menu_item(transpose_menu, _('Up %d semitones') % i, '', lambda e, i=i: self.OnTranspose(i))
  File "/nix/store/s0xx7shngbbkydwbm2g0vv34rj8dzx96-easyabc-1.3.8.6/share/easyabc/wxhelper.py", line 32, in append_menu_item
    menu_item = wx.MenuItem(menu, -1, label, description, kind)
TypeError: MenuItem(): argument 2 has unexpected type 'int'

Works fine with wxPython 4.2.0 First reported in https://github.com/NixOS/nixpkgs/pull/243561

jwdj commented 1 year ago

I have upgraded (on Windows) to wxPython 4.2.1 but there the issue is not reproducable. According to the documentation (https://wxpython.org/Phoenix/docs/html/wx.MenuItem.html#wx.MenuItem.__init__) the second argument is supposed to be an int. So I think the problem lies elsewhere. What Python version are you using?

kirillrdy commented 1 year ago

I have upgraded (on Windows) to wxPython 4.2.1 but there the issue is not reproducable. According to the documentation (https://wxpython.org/Phoenix/docs/html/wx.MenuItem.html#wx.MenuItem.__init__) the second argument is supposed to be an int. So I think the problem lies elsewhere. What Python version are you using?

I believe its 3.10.12

mausch commented 1 year ago

The Nix package uses Python 3.9. EasyABC has other known issues with Python 3.10 ( https://github.com/jwdj/EasyABC/issues/52 )

kirillrdy commented 1 year ago

The Nix package uses Python 3.9. EasyABC has other known issues with Python 3.10 ( #52 )

indeed you are right !

mausch commented 1 year ago

According to the documentation (https://wxpython.org/Phoenix/docs/html/wx.MenuItem.html#wx.MenuItem.__init__) the second argument is supposed to be an int. So I think the problem lies elsewhere.

Yeah, I'm thinking there's something wrong with the Nix package for wxPython or wxWidgets. I changed that EasyABC line to say wx.ID_ANY instead of -1 and I get TypeError: MenuItem(): argument 2 has unexpected type 'StandardID' which is a more googleable error message that led me to https://web.archive.org/web/20230603153021/https://discuss.wxpython.org/t/typeerror-menuitem-argument-2-has-unexpected-type-standardid-when-running-the-demo/36464 in which people suspect of an incorrect wxWidgets build.

I'll see if I can create a small repro.