Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#20 Crash when saving preferences on Win NT 4.0


Programm crashes (pure virtual function call) on saving
DrPython 3.5.3
Windows NT 4.0
Python 2.3


  • Logged In: YES

    I'll need some more information:

    What version of wxPython are you using?

    Do you get a dialog box?
    Do you get a traceback? (To get a traceback,
    run from a prompt, or open drpython.py in drpython, and
    run it from the program).

    When it crashes, does it crash if you save preferences
    without changing it? Specific preferences?
    Does 3.4.9 crash as well?

    • priority: 5 --> 7
  • Logged In: NO

    The problem does not occur on 3.5.0. I do not get a
    traceback since python crashes totally (dialog box:
    unhandled exception in python.exe)

    I get the error without changing anything. I start drpython (I
    have also tested to delete preferences.dat first) ->
    Options/Preferences -> Save -> Crash!!!

    I am using wxpython

  • Logged In: YES

    if you delete or rename preferences.dat before,
    does is exist after the crash?
    What are the last entries in preferences.dat?
    in mine, it is:

    Maybe you could try:

    remove the try except IOError statements in drPrefsfile.py in
    fuction onbtnsave.
    drPrefsFile.WritePreferences(self.GetPreferences(), preffile)
    If you still get no traceback, try inserting after every line
    in onbtnsave a print statement and when the crash happens,
    you can discover, where it is.
    If you found the offending function, you can put
    print statements into this again.

  • Logged In: YES

    if the file is 0 byte, you could add
    after exec(e) in WritePreferences in drPrefsfile.py
    fin.flush(), and then you can see the last entry,
    which was written successfully.

  • Logged In: NO


    I have tested version 3.5.5.

    I have traced the problem with print statements. A
    preference file gets saved, but when I run drpython next
    time it complains about it.

    The error occurs in drpython.py within the function
    updatePrefs(self, oldprefs) in the following line (about line
    no. 3363)

    self.toolbar = wx.ToolBar(self, -1, wx.DefaultPosition,
    wx.DefaultSize, wx.TB_HORIZONTAL)

  • Logged In: YES

    Gotcha. I think I know what is going on.
    If you want you rname in the credits (as opposed to
    anonymous bug-report), send an email, or post here.

    I will probably release the next version sometime tonight.


  • Logged In: YES

    Right. No idea of what is going on. I am unable to
    reproduce this bug at all.

    Have you tried upgrading to wxPython
    Does this crash 3.4.9, or 3.3.x?

  • gero

    Logged In: YES

    The problem seems to be the toolbar update. Toolbar
    configuration -> Update also crashes. I upgraded to
    wxpython and I still have the problem. Maybe it is a
    wxwidgets-on-windows-NT bug.

    However, everything still works with DrPython 3.5.0.

  • Logged In: YES

    Allright. I changed the way the toolbar is added/removed.
    (I now use the built in method, to ensure the sizing is

    I have attached a possible workaround.
    Plop it in your drpython-3.5.6 directory,
    and run it from the command line (or run it in drpy).


    1. Updating without changing anything.
    2. Setting the ToolBar Icon Size to 0, then Updating.
    3. Setting it from 0 to 24, then Updating.

    Does any of this work now?

  • gero

    Logged In: YES

    The line 3367 in your patched drpython.py:
    right after self.DestroyToolBar() in updatePrefs() solved the
    problem. The same problem occurs in drToolBarDialog.py,
    line 406. If I add a line self.parent.SetToolBar(None) just
    after self.parent.DestroyToolBar() then it works. I
    commented out lines 403 and 404 before, which seem to do
    something similar.
    Thank you very much for your help!

    • status: open --> closed-fixed
  • Logged In: YES

    Glad to have helped!
    Thanks for the testing.

    This has been fixed 3.5.7.

    In drToolBarDialog, I just moved the code to get rid of the
    toolbar to within the same if clause.

    I also made sure to edit updatePrefs so the SetToolBar(None)
    always comes after DestroyToolBar().