Pyfa crashes when trying to backup to XML on Mac.
I have to Force Quit the app, but here's a screengrab of the error I get:
Cheers,
G.
Hi,
Just checking in to see if there was an ETA for this one? It's still throwing an exception for me when backing up fits. I have ~620 fits and it crashes around the 400 mark (ish).
Cheers,
G.
@GKFC hey there. Would you be able to send your saveddata.db to [email protected]? I'm not running on a Mac, but recursion issues aren't generally platform-specific, so maybe I can take a look and figure it out. It probably has to do with the number a fits, and I don't have a test database with that many
No problems you should have it now.
It seems to backup fine for me, which is not what I was expecting.
I'm just now noticing from the screenshot that you're using v2.15 which was released way back in Nov of last year. Have you tried updating your pyfa and trying?
That screenshot is from a while ago btw...

is from an attempt just now so it's still happening for me? Please let me know what else you need from me that may help.
Cheers,
G.
Line 3259 in wx/core.py:
def CallAfter(callableObj, *args, **kw):
"""
Call the specified function after the current and pending event
handlers have been completed. This is also good for making GUI
method calls from non-GUI threads. Any extra positional or
keyword args are passed on to the callable when it is called.
:param PyObject callableObj: the callable object
:param args: arguments to be passed to the callable object
:param kw: keywords to be passed to the callable object
.. seealso::
:ref:`wx.CallLater`
"""
assert callable(callableObj), "callableObj is not callable"
app = wx.GetApp()
assert app is not None, 'No wx.App created yet'
if not hasattr(app, "_CallAfterId"):
app._CallAfterId = wx.NewEventType()
app.Connect(-1, -1, app._CallAfterId,
lambda event: event.callable(*event.args, **event.kw) ) # <--- line 3259
evt = wx.PyEvent()
evt.SetEventType(app._CallAfterId)
evt.callable = callableObj
evt.args = args
evt.kw = kw
wx.PostEvent(app, evt)
So, your XML export is failing when we do a wx.CallAfter. The only time wx.CallAfter is called during XML export is here:
https://github.com/pyfa-org/Pyfa/blob/bc2cdcdea7b67afc750fdecb2568d1e4a1753b20/gui/mainFrame.py#L913
So there seems to be some recursive issue happening, but only for mac build. I've tried to step through the logic here, but the import/export logic has always been kind of messy. On pyfa's side, we don't have any platform-specific code, so it's not like the mac build is taking a different logical path to produce the export. To further aggravate the issue, the backups happen in a separate thread, and the logger only works correctly in the main thread.
I have two thoughts:
- Either
wx.CallAfteritself is broken on mac. - The callback function that we're giving
wx.CallAfteris causing some recursive issue... somewhere. I don't see anything that we're doing in there that would cause an issue, other than messing with the progress dialog. The progress dialog has given us a lot of grief in the past, so it's possible that the way it's implemented for the mac would cause an issue.
Both of these potential issues, either wx.CallAfter or wx.ProgressDialog, won't be an easy fix since they both deal with wxPython itself.
@GKFC If you could download and try this build out: https://transfer.sh/am5GQ/pyfa-v2.24.1+13-gc21c5c4f-mac.zip
I've disabled progress bar updating (so you won't see any progress being make on the export). If this run through fine, then we've at least narrowed it down to something to do with the Progress Dialog.
Thanks, that file seems to work fine, I've just created the XML file using it.
It's probably related, but trying to Import the fits from that XML crashes Pyfa though. It didn't give me a popup like above, but a rather massive Mac Problem Report... I can send that through if needed.
Cheers,
G.
The import also uses Progress Dialog, so not surprised the import isn't working either. As for an actual fix, I don't really know.
@DarkFenX IIRC you have access to a mac. Do you know anything about ProgressDialog issues on it with our current versions? Specifically, this is what I commented out and it seems the export works now:
https://github.com/pyfa-org/Pyfa/blob/016f2b44ff87a00ea9ec103c629b36c090f38063/gui/mainFrame.py#L964
Commit: https://github.com/pyfa-org/Pyfa/commit/c21c5c4f80fb2dd5c3030041e105652b70b1f950
I think wxPython has a generic progress dialog that is written completely in python so it doesn't implement the underlying wxWidget code and thus bypasses any platform-specific bugs. If they do, we may need to look into that for the mac platform (or all our platforms and just avoid ProgressDialog since it's always given us trouble)