Cannot import QCoreApplication

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot import QCoreApplication

Brad Buran
I tried upgrading to EPD 7 from EPD 6.3 (or 6.2).  Where my programs ran fine before, I now get the following error:

  File "C:\Python27\lib\site-packages\enthought\savage\traits\ui\toolkit.py", li
ne 62, in __init__
    "%s" % (ETSConfig.toolkit, oname))
NotImplementedError: The qt4 Savage backend doesn't implementSVGButtonEditor

python -c "from enthought.savage.traits.ui.qt4.svg_button_editor import SVGButtonEditor" gives me:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\Python27\lib\site-packages\enthought\savage\traits\ui\qt4\svg_button_editor.py", line 29, in <module>
    from enthought.qt import QtCore, QtGui, QCoreApplication
ImportError: cannot import name QCoreApplication

Other PyQt4 (non-Traits based) applications run fine.  How can I fix this problem?

Thanks,
Brad

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Cannot import QCoreApplication

John Wiggins
Brad,
Change line 29 in svg_button_editor.py to:
from enthought.qt import QtCore, QtGui

And line 34 to:
QtCore.QCoreApplication.addLibraryPath(qt_plugins_dir)

That should fix it. I'll fix the version in the repository.

- John

On Fri, Feb 18, 2011 at 9:13 AM, Brad Buran <[hidden email]> wrote:

> I tried upgrading to EPD 7 from EPD 6.3 (or 6.2).  Where my programs ran
> fine before, I now get the following error:
>
>   File
> "C:\Python27\lib\site-packages\enthought\savage\traits\ui\toolkit.py", li
> ne 62, in __init__
>     "%s" % (ETSConfig.toolkit, oname))
> NotImplementedError: The qt4 Savage backend doesn't implementSVGButtonEditor
>
> python -c "from enthought.savage.traits.ui.qt4.svg_button_editor import
> SVGButtonEditor" gives me:
>
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File
> "c:\Python27\lib\site-packages\enthought\savage\traits\ui\qt4\svg_button_editor.py",
> line 29, in <module>
>     from enthought.qt import QtCore, QtGui, QCoreApplication
> ImportError: cannot import name QCoreApplication
>
> Other PyQt4 (non-Traits based) applications run fine.  How can I fix this
> problem?
>
> Thanks,
> Brad
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Cannot import QCoreApplication

John Wiggins
It looks like there is a more subtle bug left over after that fix.
This line:
qt_plugins_dir = os.path.join(os.path.dirname(QtCore.__file__), 'plugins')

Will fail to get the correct path. It's expecting something in the
site-packages/PyQt4 or site-packages/PySide directory. Instead it gets
<path to python install>/site-packages/enthought/qt/. Oops.

I'll look into a more elegant solution.

- John

On Fri, Feb 18, 2011 at 9:24 AM, John Wiggins <[hidden email]> wrote:

> Brad,
> Change line 29 in svg_button_editor.py to:
> from enthought.qt import QtCore, QtGui
>
> And line 34 to:
> QtCore.QCoreApplication.addLibraryPath(qt_plugins_dir)
>
> That should fix it. I'll fix the version in the repository.
>
> - John
>
> On Fri, Feb 18, 2011 at 9:13 AM, Brad Buran <[hidden email]> wrote:
>> I tried upgrading to EPD 7 from EPD 6.3 (or 6.2).  Where my programs ran
>> fine before, I now get the following error:
>>
>>   File
>> "C:\Python27\lib\site-packages\enthought\savage\traits\ui\toolkit.py", li
>> ne 62, in __init__
>>     "%s" % (ETSConfig.toolkit, oname))
>> NotImplementedError: The qt4 Savage backend doesn't implementSVGButtonEditor
>>
>> python -c "from enthought.savage.traits.ui.qt4.svg_button_editor import
>> SVGButtonEditor" gives me:
>>
>> Traceback (most recent call last):
>>   File "<string>", line 1, in <module>
>>   File
>> "c:\Python27\lib\site-packages\enthought\savage\traits\ui\qt4\svg_button_editor.py",
>> line 29, in <module>
>>     from enthought.qt import QtCore, QtGui, QCoreApplication
>> ImportError: cannot import name QCoreApplication
>>
>> Other PyQt4 (non-Traits based) applications run fine.  How can I fix this
>> problem?
>>
>> Thanks,
>> Brad
>>
>> _______________________________________________
>> Enthought-Dev mailing list
>> [hidden email]
>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>
>>
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Cannot import QCoreApplication

Brad Buran
I get the same on my machine:

$ python -c "from enthought.qt import QtCore; import os; print os.path.join(os.path.dirname(QtCore.__file__), 'plugins')"
c:\Python27\lib\site-packages\enthought\qt\plugins

However, the fix seems to work fine for my application.  I haven't noticed any side effects of this bug.

Brad

On Fri, Feb 18, 2011 at 10:37 AM, John Wiggins <[hidden email]> wrote:
It looks like there is a more subtle bug left over after that fix.
This line:
qt_plugins_dir = os.path.join(os.path.dirname(QtCore.__file__), 'plugins')

Will fail to get the correct path. It's expecting something in the
site-packages/PyQt4 or site-packages/PySide directory. Instead it gets
<path to python install>/site-packages/enthought/qt/. Oops.

I'll look into a more elegant solution.

- John

On Fri, Feb 18, 2011 at 9:24 AM, John Wiggins <[hidden email]> wrote:
> Brad,
> Change line 29 in svg_button_editor.py to:
> from enthought.qt import QtCore, QtGui
>
> And line 34 to:
> QtCore.QCoreApplication.addLibraryPath(qt_plugins_dir)
>
> That should fix it. I'll fix the version in the repository.
>
> - John
>
> On Fri, Feb 18, 2011 at 9:13 AM, Brad Buran <[hidden email]> wrote:
>> I tried upgrading to EPD 7 from EPD 6.3 (or 6.2).  Where my programs ran
>> fine before, I now get the following error:
>>
>>   File
>> "C:\Python27\lib\site-packages\enthought\savage\traits\ui\toolkit.py", li
>> ne 62, in __init__
>>     "%s" % (ETSConfig.toolkit, oname))
>> NotImplementedError: The qt4 Savage backend doesn't implementSVGButtonEditor
>>
>> python -c "from enthought.savage.traits.ui.qt4.svg_button_editor import
>> SVGButtonEditor" gives me:
>>
>> Traceback (most recent call last):
>>   File "<string>", line 1, in <module>
>>   File
>> "c:\Python27\lib\site-packages\enthought\savage\traits\ui\qt4\svg_button_editor.py",
>> line 29, in <module>
>>     from enthought.qt import QtCore, QtGui, QCoreApplication
>> ImportError: cannot import name QCoreApplication
>>
>> Other PyQt4 (non-Traits based) applications run fine.  How can I fix this
>> problem?
>>
>> Thanks,
>> Brad
>>
>> _______________________________________________
>> Enthought-Dev mailing list
>> [hidden email]
>> https://mail.enthought.com/mailman/listinfo/enthought-dev
>>
>>
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev