Query regarding PythonQt

Shankar Narayana shank.nasa at gmail.com
Sat Jun 28 09:36:27 EDT 2008


Hi,
  Can somebody please help me with the issue of ".pyc" creating problems
when we rerun the application, written using PythonQt ? The description of
the problem is given below.

Regards,
Shankar

On Fri, Jun 27, 2008 at 2:41 PM, Shankar Narayana <shank.nasa at gmail.com>
wrote:

> Hi,
>  I am newbie to PythonQt. I wanted to access the Qt objects created in C++
> using Python and update things. I had a look at this URL "
> http://doc.trolltech.com/qq/qq23-pythonqt.html#decoratorsandcwrappers"
> which talks about using PythonQt for the same.
>   I followed the instructions given in the example. I created my cpp file
> and .py file and could make them working.
>   But once after the first time after .pyc file is created, my program no
> longer executes. It is giving me a segmentation fault. If I remove my .pyc
> file and run the program, things work fine.
>
> My cpp file
> #include <QApplication>
> #include <QTextEdit>
> #include "PythonQt.h"
> int main(int argc, char* argv[])
> {
>     QApplication app(argc,argv);
>     QTextEdit *welcomemsg = new QTextEdit("Hi whatsup");
>     PythonQt::init();
>     PythonQtObjectPtr mainModule = PythonQt::self()->getMainModule();
>     mainModule.addObject("welcomemsg",welcomemsg);  // Check with different
> names
>     mainModule.evalFile("Pyscript.py");
>     mainModule.removeVariable("welcomemsg");
>     PythonQt::cleanup();
>     return app.exec();
> }
>
> My Python file  (Pyscript.py)
>
> from PythonQt import *
> #append the text to the existing text edit
> welcomemsg.append("Hurray I did it")
> welcomemsg.show()
>
> Can somebody help me what makes this not to run once Python interpreter
> works on the Python file and creates a .pyc file ?
>
>
> Regards,
> Shankar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080628/6505aade/attachment-0001.html>


More information about the Python-list mailing list