Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. PySide: python IDLE lacks compatibility
Forum Update on Monday, May 27th 2025

PySide: python IDLE lacks compatibility

Scheduled Pinned Locked Moved Language Bindings
7 Posts 3 Posters 7.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    OldAl
    wrote on 1 Nov 2010, 00:14 last edited by
    #1

    PySide shows great promise. It would help if it was able to repeat running of programs in IDLE editor window. Currently it is possible to run a program from IDLE editor window once, but attempt to repeat the run in the same session fails, because IDLE complains alleging that QApplication is already running. This makes IDLE not useful as editor for PySide program development.

    A brief example:

    A program from IDLE editor window:


    from PySide.QtGui import QApplication
    import sys

    print 'trying to use python-idle for PySide'
    app = QApplication(sys.argv)


    And now results of attempting to run it twice:


    IDLE 2.6.6 ==== No Subprocess ====

    trying to use python-idle for PySide

    trying to use python-idle for PySide
    Traceback (most recent call last):
    File "/home/ak/show_idle_bug.py", line 5, in <module>
    app = QApplication(sys.argv)
    RuntimeError: A QApplication instance already exists.


    Any suggestions how to enable IDLE to edit PySide based programs during several development stages? Eric also raises some issues. vi works, as do other pure text editors, but it would be easier if an interactive editor with de-bugging facilities was accessible.

    OldAl

    1 Reply Last reply
    0
    • D Offline
      D Offline
      danilocesar
      wrote on 1 Nov 2010, 12:38 last edited by
      #2

      Humm, I think it's not a pyside problem, but it's a IDLE issue.

      Does it happens with pyqt too? I believe IDLE keeps the QApplication instance alive for every python bind of qt... And, as you know, you can't have two instances of qapp in the same application.

      <a href="http://www.danilocesar.com">Danilo Cesar Lemes de Paula</a>
      Software Engineer

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Franzk
        wrote on 2 Nov 2010, 06:19 last edited by
        #3

        Maybe one of the following will help:

        @app = None@
        @del app@

        Both should remove the reference to the QApplication. Because Python is garbage collected you cannot assume it is actually cleaned up there, so you might have to look for other places where the app is referenced.

        "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • O Offline
          O Offline
          OldAl
          wrote on 3 Nov 2010, 02:29 last edited by
          #4

          [quote author="danilocesar" date="1288615082"]Humm, I think it's not a pyside problem, but it's a IDLE issue.
          .[/quote]
          I do not think we can blame IDLE - it works fine with Python (including PyQt4) programs - and has been doing that well for a long, long time! It works fine with PyQt4, but screws up with PySide. Does not sound like an IDLE fault to me. Here is another example with two sets of answers - one when PySide is used, the other when PyQt4 is used.
          [CODE]
          #!/usr/bin/env python
          '''show_idle_bug.py - no parameters'''

          ##flag = True
          flag = False

          if flag:
          from PySide.QtGui import QApplication
          else:
          import sip
          sip.setapi("QApplication", 2)
          from PyQt4.QtGui import QApplication
          import sys

          for i in range(10):
          print "flag = %s" % (flag)
          app = QApplication(sys.argv)

          -----------------------------------------------

          ##Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
          ##[GCC 4.4.5] on linux2
          ##Type "copyright", "credits" or "license()" for more information.
          ##IDLE 2.6.6

          -----------------------------------------------

          ##>>>
          ##flag = True
          ##flag = True
          ##Traceback (most recent call last):

          File "/home/ak/show_idle_bug.py", line 16, in <module>

          app = QApplication(sys.argv)

          ##RuntimeError: A QApplication instance already exists.
          ##>>>

          ------------------------------------------------

          ##>>>
          ##flag = False
          ##flag = False
          ##flag = False
          ##flag = False
          ##flag = False
          ##flag = False
          ##flag = False
          ##flag = False
          ##flag = False
          ##flag = False
          ##>>>

          -----------------------------------------------

          [/CODE]

          OldAl - unhappy :(

          1 Reply Last reply
          0
          • O Offline
            O Offline
            OldAl
            wrote on 3 Nov 2010, 02:37 last edited by
            #5

            [quote author="Franzk" date="1288678762"]Maybe one of the following will help:

            @app = None@
            @del app@
            [/quote]

            I've tried that without much joy, but thanks a lot for a sensible suggestion. Because of a different PySide glitch, Eric will not work satisfactorily with PySide programs in the debug stage. So the two main Python editors are not available with PySide - an unwelcome limitation IMHO. It is not critical, I can work fine with Kate or even vi, but it adds an unnecessary additional burden.

            Who "hears the cries of the poor"?

            OldAl.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              danilocesar
              wrote on 3 Nov 2010, 11:04 last edited by
              #6

              Well, if PyQt does this, its behavior is slightly different from the official QApplication documentation.

              Anyway, you can always create a feature request (or bug ?) on "pyside's bugzilla":http://bugs.openbossa.org/.

              "Who “hears the cries of the poor”?" - pyside developers are playing around here for a while. =)

              <a href="http://www.danilocesar.com">Danilo Cesar Lemes de Paula</a>
              Software Engineer

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Franzk
                wrote on 4 Nov 2010, 06:16 last edited by
                #7

                The fact that QCoreApplication behaves somewhat like a Singleton is bugging me. Although it is obviously sensible to have only one instance of a QCoreApplication around, I can't help but feel that there would be a much more reasonable way to make this work. I mean, if I want to try and drive two cars at the same time, it's the police who will try to stop me, not the car.

                "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0

                1/7

                1 Nov 2010, 00:14

                • Login

                • Login or register to search.
                1 out of 7
                • First post
                  1/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved