3

Im new in Qt and im trying to execute a program in a python subprocess:

class MiThread(threading.Thread):  
      def __init__(self):  
          threading.Thread.__init__(self)   

      def run(self):
        try:
            from Queue import Queue, Empty
        except ImportError:
    #from queue import Queue, Empty  # python 3.x
            print "error"
        ON_POSIX = 'posix' in sys.builtin_module_names

        def enqueue_output(out, queue):
            for line in iter(out.readline, b''):
                queue.put(line)
            out.close()
        p= Popen(["java -Xmx256m -jar bin/HelloWorld.jar"],cwd=r'/home/karen/sphinx4-1.0beta5-src/sphinx4-1.0beta5/',stdout=PIPE, shell=True, bufsize= 4024)
        q = Queue()
        t = Thread(target=enqueue_output, args=(p.stdout, q))
        print "estoy en el hilo"
        t.daemon = True # thread dies with the program
        t.start()

But when i execute it fails with the following error:

QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)

How can i fix it?

karensantana
  • 1,599
  • 4
  • 21
  • 34
  • 2
    In C++ if you wan't to use some type in queued connection type you should call `qRegisterMetaType("MyType")`. I'm not sure how to do this in python but probably you should add similar call with `QTextCursor` – Kamil Klimek Nov 30 '12 at 08:31
  • Can you show the code that's actually causing the error? The code you've added has nothing at all to do with Qt. – Dan Milburn Nov 30 '12 at 09:55

0 Answers0