Quality assurance in Python projects containing C modules

Discussion in 'Python' started by NoelByron@gmx.net, Mar 10, 2008.

  1. Guest

    Hello!

    We are thinking about writing a project for several customers in
    Python. This project would include (among others) wxPython, a C/C++
    module. But what happens if this application generates a segmentation
    fault on a customers PC. What changes do we have to trace back the
    source of the error? Imagine you use two or three C libraries in a
    Python project and you experience random crashes in 'Python.exe'. What
    would you do?

    We intent to target mainly the Windows platform. Is there for example
    a way to use 'dbghelp.dll'?

    Best regards and thank you!
    Noel
     
    , Mar 10, 2008
    #1
    1. Advertising

  2. Duncan Booth Guest

    wrote:

    > Hello!
    >
    > We are thinking about writing a project for several customers in
    > Python. This project would include (among others) wxPython, a C/C++
    > module. But what happens if this application generates a segmentation
    > fault on a customers PC. What changes do we have to trace back the
    > source of the error? Imagine you use two or three C libraries in a
    > Python project and you experience random crashes in 'Python.exe'. What
    > would you do?
    >

    I would start by ensuring that any DLLs you write are written using Pyrex
    or Cython: almost always problems with C libraries called from Python are
    due to faulty reference counting but if you keep all of your Python related
    code in Pyrex/Cython modules the reference counting problem should be taken
    care of for you. You can call any required C/C++ code from the Cython code.
     
    Duncan Booth, Mar 10, 2008
    #2
    1. Advertising

  3. Duncan Booth wrote:
    > wrote:
    >> We are thinking about writing a project for several customers in
    >> Python. This project would include (among others) wxPython, a C/C++
    >> module. But what happens if this application generates a segmentation
    >> fault on a customers PC. What changes do we have to trace back the
    >> source of the error? Imagine you use two or three C libraries in a
    >> Python project and you experience random crashes in 'Python.exe'. What
    >> would you do?
    >>

    > I would start by ensuring that any DLLs you write are written using Pyrex
    > or Cython: almost always problems with C libraries called from Python are
    > due to faulty reference counting but if you keep all of your Python related
    > code in Pyrex/Cython modules the reference counting problem should be taken
    > care of for you. You can call any required C/C++ code from the Cython code.


    I think the OP meant to use wxPython as an external module, in which case he
    has no way of influencing the language it is implemented in.

    My personal experience with wxPython has its ups and downs. Specifically when
    it comes to crashes, I wouldn't bet my life on it. (but then, the OP aims for
    using Windows anyway, so maybe there are ways to hide the crash of wxPython
    behind a full-fledged system crash to avoid being blamed...)

    Stefan
     
    Stefan Behnel, Mar 10, 2008
    #3
  4. wxPython/wxWidgets ok for production use ? (was Re: Quality assurancein Python projects containing C modules)

    Stefan,

    > My personal experience with wxPython has its ups and downs. Specifically when it comes to crashes, I wouldn't bet my life on it. (but then, the OP


    I'm new to Python and getting ready to build a small client based
    application intended to run on Windows and Linux. I was planning on
    using wxPython until I saw your comment above.

    Any suggestions on an alternative Python client-side GUI library (pyQT
    ?) or tips on where I can find out more about wxPython/wxWidget
    problems?

    Thank you,
    Malcolm
     
    Malcolm Greene, Mar 10, 2008
    #4
  5. Re: wxPython/wxWidgets ok for production use ? (was Re: Qualityassurance in Python projects containing C modules)

    On Mar 10, 10:27 am, "Malcolm Greene" <> wrote:
    > Stefan,
    >
    > > My personal experience with wxPython has its ups and downs. Specifically when it comes to crashes, I wouldn't bet my life on it. (but then, the OP

    >
    > I'm new to Python and getting ready to build a small client based
    > application intended to run on Windows and Linux. I was planning on
    > using wxPython until I saw your comment above.
    >
    > Any suggestions on an alternative Python client-side GUI library (pyQT
    > ?) or tips on where I can find out more about wxPython/wxWidget
    > problems?
    >
    > Thank you,
    > Malcolm


    We use wxPython here at work for new application development and have
    had no major problems with it once we knew what dlls to include. In my
    experience, I've needed gdiplus.dll, msvcp71.dll and MSVCR71.dll from
    time to time.

    Mike
     
    Mike Driscoll, Mar 10, 2008
    #5
  6. Duncan Booth Guest

    Stefan Behnel <> wrote:
    > Duncan Booth wrote:
    >> I would start by ensuring that any DLLs you write are written using
    >> Pyrex or Cython: almost always problems with C libraries called from
    >> Python are due to faulty reference counting but if you keep all of
    >> your Python related code in Pyrex/Cython modules the reference
    >> counting problem should be taken care of for you. You can call any
    >> required C/C++ code from the Cython code.

    >
    > I think the OP meant to use wxPython as an external module, in which
    > case he has no way of influencing the language it is implemented in.


    The OP mentioned 'two or three C libraries', so I assume wxPython is only
    part of the story.
     
    Duncan Booth, Mar 10, 2008
    #6
  7. Re: wxPython/wxWidgets ok for production use ?

    Malcolm Greene wrote:
    >> My personal experience with wxPython has its ups and downs. Specifically
    >> when it comes to crashes, I wouldn't bet my life on it.

    >
    > I'm new to Python and getting ready to build a small client based
    > application intended to run on Windows and Linux. I was planning on using
    > wxPython until I saw your comment above.


    Just to make this sound a bit less like FUD: my last experience with wxPython
    dates back a couple of years (2004/5?), but back then, we used BoaConstructor
    in a project, which crashed a bit too often to do real work with it - and with
    crashing I mean crashing Python, not just showing us its blank traceback. So
    this was definitely a problem either in wxWindows or in wxPython.

    I have no idea how well it works today, but this has definitely forged my
    opinion on wxPython.


    > Any suggestions on an alternative Python client-side GUI library (pyQT ?)
    > or tips on where I can find out more about wxPython/wxWidget problems?


    The only other GUI library I used was PyQT3. To me, it has proven to be very
    stable, pretty easy to use and feature rich. And from what I read about it,
    PyQT4 is supposed to be another lot better and has removed the few API quirks
    I found at the time (AFAIR, it finally returns plain Python strings from the
    API, for example).

    Stefan
     
    Stefan Behnel, Mar 10, 2008
    #7
  8. Duncan Booth wrote:
    > Stefan Behnel <> wrote:
    >> Duncan Booth wrote:
    >>> I would start by ensuring that any DLLs you write are written using
    >>> Pyrex or Cython: almost always problems with C libraries called from
    >>> Python are due to faulty reference counting but if you keep all of
    >>> your Python related code in Pyrex/Cython modules the reference
    >>> counting problem should be taken care of for you. You can call any
    >>> required C/C++ code from the Cython code.

    >> I think the OP meant to use wxPython as an external module, in which
    >> case he has no way of influencing the language it is implemented in.

    >
    > The OP mentioned 'two or three C libraries', so I assume wxPython is only
    > part of the story.


    Ah, sorry, I missed that. Sure, if it's about integrating C/C++ libraries as
    Python modules, then I second the recommendation of using Cython.

    Stefan
     
    Stefan Behnel, Mar 10, 2008
    #8
  9. Stef Mientki Guest

    Re: wxPython/wxWidgets ok for production use ?

    Stefan Behnel wrote:
    > Malcolm Greene wrote:
    >
    >>> My personal experience with wxPython has its ups and downs. Specifically
    >>> when it comes to crashes, I wouldn't bet my life on it.
    >>>

    >> I'm new to Python and getting ready to build a small client based
    >> application intended to run on Windows and Linux. I was planning on using
    >> wxPython until I saw your comment above.
    >>

    >
    > Just to make this sound a bit less like FUD: my last experience with wxPython
    > dates back a couple of years (2004/5?), but back then, we used BoaConstructor
    > in a project, which crashed a bit too often to do real work with it - and with
    > crashing I mean crashing Python, not just showing us its blank traceback. So
    > this was definitely a problem either in wxWindows or in wxPython.
    >
    > I have no idea how well it works today, but this has definitely forged my
    > opinion on wxPython.
    >
    >
    >

    I'm using wxPython for half a year now, and building quit a large /
    heavy GUI with it.
    And although it's not so easy as Delphi, it's certainly just as stable
    as Delphi.

    If you're talking about Boa, that's a completely different story,
    I tried it on 3 different machines, and couldn't get it working on any
    of them.
    I think Boa / Dabo / .. are basically good ideas to make programming
    wxPython more easy,
    and probably a lot of people invested a lot of their free time in the
    product with the best intentions,
    but unfortunately these programs are not ready for use by others
    (specially not for windows users).

    I'ld suggest that you download the wxPython demo (with interactive
    editor) and see for yourself.

    cheers,
    Stef
     
    Stef Mientki, Mar 10, 2008
    #9
  10. Re: wxPython/wxWidgets ok for production use ?

    On Mar 10, 2:11 pm, Stefan Behnel <> wrote:
    > Malcolm Greene wrote:
    > >> My personal experience with wxPython has its ups and downs. Specifically
    > >> when it comes to crashes, I wouldn't bet my life on it.

    >
    > > I'm new to Python and getting ready to build a small client based
    > > application intended to run on Windows and Linux. I was planning on using
    > > wxPython until I saw your comment above.

    >
    > Just to make this sound a bit less like FUD: my last experience with wxPython
    > dates back a couple of years (2004/5?), but back then, we used BoaConstructor
    > in a project, which crashed a bit too often to do real work with it - and with
    > crashing I mean crashing Python, not just showing us its blank traceback. So
    > this was definitely a problem either in wxWindows or in wxPython.
    >
    > I have no idea how well it works today, but this has definitely forged my
    > opinion on wxPython.
    >
    > > Any suggestions on an alternative Python client-side GUI library (pyQT ?)
    > > or tips on where I can find out more about wxPython/wxWidget problems?

    >
    > The only other GUI library I used was PyQT3. To me, it has proven to be very
    > stable, pretty easy to use and feature rich. And from what I read about it,
    > PyQT4 is supposed to be another lot better and has removed the few API quirks
    > I found at the time (AFAIR, it finally returns plain Python strings from the
    > API, for example).
    >
    > Stefan


    I agree with Stef. Boa is definitely goofy and while I know some
    people swear by it, I see far too many people having issues. I go with
    hand coding or XRC. Some also like SPE, but I haven't tried that to
    know.

    Mike
     
    Mike Driscoll, Mar 10, 2008
    #10
  11. Guest

    Re: wxPython/wxWidgets ok for production use ?

    On Mar 10, 3:33 pm, Mike Driscoll <> wrote:
    > On Mar 10, 2:11 pm, Stefan Behnel <> wrote:
    >
    >
    >
    > > Malcolm Greene wrote:
    > > >> My personal experience with wxPython has its ups and downs. Specifically
    > > >> when it comes to crashes, I wouldn't bet my life on it.

    >
    > > > I'm new to Python and getting ready to build a small client based
    > > > application intended to run on Windows and Linux. I was planning on using
    > > > wxPython until I saw your comment above.

    >
    > > Just to make this sound a bit less like FUD: my last experience with wxPython
    > > dates back a couple of years (2004/5?), but back then, we used BoaConstructor
    > > in a project, which crashed a bit too often to do real work with it - and with
    > > crashing I mean crashing Python, not just showing us its blank traceback. So
    > > this was definitely a problem either in wxWindows or in wxPython.

    >
    > > I have no idea how well it works today, but this has definitely forged my
    > > opinion on wxPython.

    >
    > > > Any suggestions on an alternative Python client-side GUI library (pyQT ?)
    > > > or tips on where I can find out more about wxPython/wxWidget problems?

    >
    > > The only other GUI library I used was PyQT3. To me, it has proven to be very
    > > stable, pretty easy to use and feature rich. And from what I read about it,
    > > PyQT4 is supposed to be another lot better and has removed the few API quirks
    > > I found at the time (AFAIR, it finally returns plain Python strings from the
    > > API, for example).

    >
    > > Stefan

    >
    > I agree with Stef. Boa is definitely goofy and while I know some
    > people swear by it, I see far too many people having issues. I go with
    > hand coding or XRC. Some also like SPE, but I haven't tried that to
    > know.
    >
    > Mike


    SPE is actually a very good editor--I'm using it for all my Python
    coding. It integrates well with wxglade, and wxpython, and is built
    on wxpython. I've used wxpython on a couple of little projects, and
    it works very well (on Linux, anyways). I'm starting a couple of
    bigger projects now, and am confident that it will scale up, seeing
    some of the projects that are using it.
    I've tried Boa a couple of times but, for me, the interface sucks, and
    is not very intuitive.
     
    , Mar 11, 2008
    #11
  12. Benjamin Guest

    Re: wxPython/wxWidgets ok for production use ?

    On Mar 10, 2:11 pm, Stefan Behnel <> wrote:
    > Malcolm Greene wrote:
    > >> My personal experience with wxPython has its ups and downs. Specifically
    > >> when it comes to crashes, I wouldn't bet my life on it.

    >
    > > I'm new to Python and getting ready to build a small client based
    > > application intended to run on Windows and Linux. I was planning on using
    > > wxPython until I saw your comment above.

    >
    > Just to make this sound a bit less like FUD: my last experience with wxPython
    > dates back a couple of years (2004/5?), but back then, we used BoaConstructor
    > in a project, which crashed a bit too often to do real work with it - and with
    > crashing I mean crashing Python, not just showing us its blank traceback. So
    > this was definitely a problem either in wxWindows or in wxPython.
    >
    > I have no idea how well it works today, but this has definitely forged my
    > opinion on wxPython.
    >
    > > Any suggestions on an alternative Python client-side GUI library (pyQT ?)
    > > or tips on where I can find out more about wxPython/wxWidget problems?

    >
    > The only other GUI library I used was PyQT3. To me, it has proven to be very
    > stable, pretty easy to use and feature rich. And from what I read about it,
    > PyQT4 is supposed to be another lot better and has removed the few API quirks
    > I found at the time (AFAIR, it finally returns plain Python strings from the
    > API, for example).

    No, it still returns QStrings, so it doesn't break tons of code. I
    just always convert it to unicode if I'm going to keep the string
    around.
    >
    > Stefan
     
    Benjamin, Mar 11, 2008
    #12
  13. Re: wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

    On Mon, 10 Mar 2008 11:27:06 -0400, "Malcolm Greene"
    <> wrote:
    >Any suggestions on an alternative Python client-side GUI library (pyQT
    >?) or tips on where I can find out more about wxPython/wxWidget
    >problems?


    One thing that bothers me is that it seems like there's no ecosystem
    around it, so the only widgets available are those that come from
    wxWidgets proper.

    For instance, I find the grid object a bit poor-featured compared to
    what's available for VB6, .Net, or Delphi, but I didn't find
    alternatives.
     
    Gilles Ganault, Mar 11, 2008
    #13
  14. Re: wxPython/wxWidgets ok for production use ? (was Re: Qualityassurance in Python projects containing C modules)

    Gilles Ganault wrote:
    > On Mon, 10 Mar 2008 11:27:06 -0400, "Malcolm Greene"
    > <> wrote:
    > >Any suggestions on an alternative Python client-side GUI library (pyQT
    > >?) or tips on where I can find out more about wxPython/wxWidget
    > >problems?

    >
    > One thing that bothers me is that it seems like there's no ecosystem
    > around it, so the only widgets available are those that come from
    > wxWidgets proper.
    >
    > For instance, I find the grid object a bit poor-featured compared to
    > what's available for VB6, .Net, or Delphi, but I didn't find
    > alternatives.


    I do not know if this helps, but here is an extract from a recent post
    to the wxPython mailing list from Robin Dunn, the main developer of
    wxPython -

    "The new wxDataViewCtrl coming in 2.9 might make this unnecessary.
    Think of it as a wxListCtrl that is always in virtual mode with a plug-
    in data model, can optionally have hierarchical data (like wxTreeCtrl)
    in one of the columns, and where every column can have a custom
    renderer/editor for the cells like wxGrid. And it uses the native
    controls on Mac and GTK. I've been working on the wrappers for it off
    and on over the past few weeks and while it is a complex beast, it
    will probably be easier to use than wxGrid in most cases and easier
    than wxListCtrl in some cases too."

    I also strongly recommend using the mailing list for any questions,
    problems, or feature requests. Robin is a very active contributor to
    the list, and frequently provides very insightful answers. Also there
    are a number of other active contributors, some of whom have designed
    their own composite widgets using the underlying components of the
    toolkit, and are happy to share them.

    Frank Millman
     
    Frank Millman, Mar 11, 2008
    #14
  15. Guest

    Re: wxPython/wxWidgets ok for production use ? (was Re: Qualityassurance in Python projects containing C modules)

    Hi Malcom

    On Mar 10, 4:27 pm, "Malcolm Greene" <> wrote:
    > I'm new to Python and getting ready to build a small client based
    > application intended to run on Windows and Linux. I was planning on
    > using wxPython until I saw your comment above.


    We use wxPython and Python internally in the company without any mayor
    problems or crashes. It seems quite solid. But errors happen in
    complex systems. And if for example a crash occurs it would be good to
    know the reason and to track it down. And that is hard in Python with
    C extensions. That does not only apply to wxPython but to all other
    (GUI) libraries with C parts, too. At least we will not switch to
    something else then wxPython.

    Best regards,
    Noel
     
    , Mar 11, 2008
    #15
  16. Re: wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

    On Mon, 10 Mar 2008 22:17:16 -0700 (PDT), Frank Millman
    <> wrote:
    >I do not know if this helps, but here is an extract from a recent post
    >to the wxPython mailing list from Robin Dunn, the main developer of
    >wxPython -


    I'll take a look. Thanks for the info.
     
    Gilles Ganault, Mar 11, 2008
    #16
  17. Stef Mientki Guest

    Re: wxPython/wxWidgets ok for production use ? (was Re: Quality assurancein Python projects containing C modules)

    Gilles Ganault wrote:
    > On Mon, 10 Mar 2008 11:27:06 -0400, "Malcolm Greene"
    > <> wrote:
    >> Any suggestions on an alternative Python client-side GUI library (pyQT
    >> ?) or tips on where I can find out more about wxPython/wxWidget
    >> problems?

    >
    > One thing that bothers me is that it seems like there's no ecosystem
    > around it, so the only widgets available are those that come from
    > wxWidgets proper.
    >
    > For instance, I find the grid object a bit poor-featured compared to
    > what's available for VB6, .Net, or Delphi, but I didn't find
    > alternatives.


    Funny, compared to Delphi-7,
    I found the grid in wxPython much richer ;-)
    Very easy to add own in place editors,
    easy add checkboxes, colorpickers etc into the grid.

    cheers,
    Stef
     
    Stef Mientki, Mar 11, 2008
    #17
  18. Re: wxPython/wxWidgets ok for production use ?

    Stefan Behnel <> wrote:
    >Just to make this sound a bit less like FUD: my last experience with wxPython
    >dates back a couple of years (2004/5?), but back then, we used BoaConstructor
    >in a project, which crashed a bit too often to do real work with it - and with
    >crashing I mean crashing Python, not just showing us its blank traceback. So
    >this was definitely a problem either in wxWindows or in wxPython.


    I spent a couple of years maintaining and developing a series of
    commercial wxPython-based applications (up until about 18 months ago
    when I changed job), and I would happily describe wxPython itself as
    stable enough for production code. The biggest problem I had with it
    was its failure to be anywhere near as transparently cross-platform as
    one might be lead to expect.

    And before you blame wx* for crashes: what platform was this on?
    Because my experience was that wx on GTK was significantly more prone
    to glitches than on Windows (through to wxglade being unusably crashy)
    -- if the underlying toolkit has problems, that's going to be
    reflected in wx.

    --
    \S -- -- http://www.chaos.org.uk/~sion/
    "Frankly I have no feelings towards penguins one way or the other"
    -- Arthur C. Clarke
    her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
     
    Sion Arrowsmith, Mar 11, 2008
    #18
  19. Re: wxPython/wxWidgets ok for production use ?

    Sion Arrowsmith wrote:
    > And before you blame wx* for crashes: what platform was this on?
    > Because my experience was that wx on GTK was significantly more prone
    > to glitches than on Windows (through to wxglade being unusably crashy)
    > -- if the underlying toolkit has problems, that's going to be
    > reflected in wx.


    :) Interesting. This was actually on GTK. Although I would still blame at
    least the wxWidgets-GTK bindings here. I never had any problems with GTK in my
    life.

    Stefan
     
    Stefan Behnel, Mar 11, 2008
    #19
  20. Chris Mellon Guest

    Re: wxPython/wxWidgets ok for production use ?

    On Tue, Mar 11, 2008 at 11:01 AM, Stefan Behnel <> wrote:
    > Sion Arrowsmith wrote:
    > > And before you blame wx* for crashes: what platform was this on?
    > > Because my experience was that wx on GTK was significantly more prone
    > > to glitches than on Windows (through to wxglade being unusably crashy)
    > > -- if the underlying toolkit has problems, that's going to be
    > > reflected in wx.

    >
    > :) Interesting. This was actually on GTK. Although I would still blame at
    > least the wxWidgets-GTK bindings here. I never had any problems with GTK in my
    > life.


    Gtk is much more finicky than windows about the timingof when you can
    and cannot use certain functions. wxPython has checks in place for
    many of these functions so you get an exception instead of a crash,
    but not everything is safe (and of course in the past even fewer
    things were). In particular, you need to have a wxApp object safely
    constructed before you can use almost any gui object, which is not the
    case under Windows.

    wx makes the attempt to make correct code work correctly on platforms,
    but doesn't necessarily guarantee that incorrect code fails the same
    (or at all) on all platforms. This is an unavoidable compromise due to
    the nature of a layering toolkit like this, although figuring out what
    "correct code" actually is can take some experience.

    >
    >
    >
    > Stefan
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
     
    Chris Mellon, Mar 11, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    923
  2. Stefan Ram
    Replies:
    4
    Views:
    483
    Chris Uppal
    Feb 1, 2006
  3. Kandidates
    Replies:
    0
    Views:
    382
    Kandidates
    Aug 12, 2003
  4. Replies:
    0
    Views:
    470
  5. Replies:
    5
    Views:
    462
    Keith Thompson
    Aug 16, 2006
Loading...

Share This Page