2

I'm getting following error on starting debug session in Eclipse for my code which uses Enthought Mayavi and PyQt as well. Here is the error log in the console.

pydev debugger: starting (pid: 2208)
Traceback (most recent call last):
  File "D:\eclipse\plugins\org.python.pydev_3.7.1.201409021729\pysrc\pydevd.py",

line 2090, in debugger.run(setup['file'], None, None) File "D:\eclipse\plugins\org.python.pydev_3.7.1.201409021729\pysrc\pydevd.py", line 1547, in run pydev_imports.execfile(file, globals, locals) # execute the script File "D:\src\Candls_PyQt\src\application.py", line 10, in sip.setapi("QString",2) ValueError: API 'QString' has already been set to version 1

Here is my code snippet.

from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt4'

import sip
sip.setapi("QString",2) 
sip.setapi("QVariant",2)
from PyQt4 import QtCore, QtGui, uic 
greg-449
  • 109,219
  • 232
  • 102
  • 145
  • Are you sure that your very first line does not result in any `PyQt4` import somewhere? That's usually the case - `setapi` calls must happen before any PyQt import. – sebastian Sep 24 '14 at 07:46
  • I don't know eclipse, but are you running your code in pylab mode? That would set the GUI backend before your snippet ran. – Jonathan March Sep 24 '14 at 15:25

1 Answers1

1

This was an issue introduced in the latest version of the debugger.

The bug in PyDev is: https://sw-brainwy.rhcloud.com/tracker/PyDev/452 (it was fixed already but it's still not in a released version).

A workaround for now would be manually applying the fix: https://github.com/fabioz/Pydev/commit/af39f23bc884e9514aaaeede7b6e77e22b6823f6 in your local version of pydev_monkey_qt.py (inside eclipse/plugins/org.python.pydev/pysrc)

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78