Anonymous - 2010-07-02

Hi Guys,

First of all, here's my development configuration:
Compiler: MS Visual C++ 2008 Express
Python: ver. 2.6.5 (compiled from src)
Qt: ver. 4.6.3 (compiled from src)
PythonQt: ver. 2.0.1 (compiled from src)

I'm running this tiny peace of code:

int main( int argc, char* argv[] ) {

    QApplication app(argc, argv);
    PythonQt::init();
    PythonQt_QtAll::init();
    PythonQtObjectPtr context = PythonQt::self()->getMainModule();
    QPushButton b("Blubb");
    context.addObject("button", &b);
    context.evalFile("M:\\to\\TOE\\Praktikanten\\Martin Bertsche\\Bachelor-Arbeit\\Workspaces\\PythonQtProjectTemplate\\Release\\doSomething.py");
    QVariant v = context.call("palim");
    if (v.isValid())
        std::cout << v.toInt();
    else
        std::cout << "Error!";
    b.show();
    return app.exec();
}

And this being the Script with the very long path:

def palim():
    if button != None:
        button.text = 'Success'
        return 1
    else:
        return 0

The software crashes on exit, most probably due to a destructor call that fails for some reason. I Already read about people having the same problem on former versions. Unfortunately I wasn't able to find their solutions. The link was dead.
Curiously the same thing happens as well if I reduce the Script to only returning an arbitrary string. Of course I will have to change

v.toInt()

to

v.toString().toStdString()

. But still this very simple example keeps crashing.
Is there any known reason for this?