API 'QString' has already been set to version 1 on Eclipse
Question: 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 
    


Answer: 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)

