For the record, another way to solve this (while keeping the Matplotlib patch enabled) would be to set the PyQt API to version 2 (Console preferences > External modules).
By the way, the issue 825 has already been taken care of. Cheers Pierre Le 4 nov. 2011 à 11:03, Janwillem van Dijk <[email protected]> a écrit : > Indeed that solves the problem. I cannot, however, pretend that I understand > why but you helped me. > Thanks, Janwillem > > On 11/03/2011 10:11 PM, Pierre Raybaut wrote: >> Could you please try to simply disable the "Matplolib" patch option? >> By default, Spyder is monkey-patching Matplotlib to ensure that the Qt >> backend is selected (and eventually to add the figure options toolbar >> button which has been integrated in Matplotlib v1.0). >> >> We could separate the "set backend" part from the "options button" >> part in this monkey-patch because this is the latter which is >> responsible for this as it is importing PyQt objects (in Python 2.x, >> this selects by default the PyQt API v1) before the ETS toolkit try to >> select the PyQt API v2. Hence the warnings, and the traceback which >> simply means that with PyQt API v1, the nameFilters method returns a >> QStringList -which has no 'index' method- whereas it returns a Python >> list object with PyQt API v2 -- that is what pyface is apparently >> expecting. >> >> I've just filled out an issue for this: >> http://code.google.com/p/spyderlib/issues/detail?id=825 >> >> HTH >> Pierre >> >> Le 3 nov. 2011 à 20:59, Janwillem van Dijk<[email protected]> a écrit : >> >>> When I run this small script from the command line (ubuntu 11.10) all is >>> good. >>> >>> from traits.etsconfig.etsconfig import ETSConfig >>> ETSConfig.toolkit = 'qt4' >>> print 'toolkit: ',ETSConfig.toolkit >>> from pyface.api import FileDialog, OK >>> fdialog = FileDialog(action='open files',title='Choose files to open') >>> if fdialog.open() == OK: >>> for fname in fdialog.paths: >>> print fname >>> print 'finished' >>> >>> However, when running from within Spyder 2.1.1 (F5) I get the error >>> messages shown below. If I set the toolkit to 'wx', both command line and >>> running from within Spyder is OK. What is the meaning of the messages?? >>> >>> toolkit: qt4 >>> Warning/PyQt4-Spyder (API 'QString' has already been set to version 1) >>> Warning/PyQt4-Spyder (API 'QVariant' has already been set to version 1) >>> Traceback (most recent call last): >>> File "/home/......./test_fileopen.py", line 7, in<module> >>> if fdialog.open() == OK: >>> File "/usr/lib/python2.7/dist-packages/pyface/i_dialog.py", line 122, in >>> open >>> self.close() >>> File "/usr/lib/python2.7/dist-packages/pyface/ui/qt4/file_dialog.py", line >>> 100, in close >>> self.wildcard_index = self.control.nameFilters().index( >>> AttributeError: 'QStringList' object has no attribute 'index' >>> >>> Thanks, Janwillem >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "spyder" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/spyderlib?hl=en. >>> > > -- > You received this message because you are subscribed to the Google Groups > "spyder" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/spyderlib?hl=en. > -- You received this message because you are subscribed to the Google Groups "spyder" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
