【已解决】Eclipse+PyDev无法调试Python:Unexpected IO Exception in Pydev debugger

【问题】

环境:

Eclipse 3.6

PyDev 1.6

Python 2.6

错误:

Unexpected IO Exception in Pydev debugger
Address already in use: JVM_Bind:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at org.python.pydev.debug.model.remote.ListenConnector.<init>(ListenConnector.java:16)
at org.python.pydev.debug.model.remote.RemoteDebugger.startConnect(RemoteDebugger.java:33)
at org.python.pydev.debug.ui.launching.PythonRunner.runDebug(PythonRunner.java:112)
at org.python.pydev.debug.ui.launching.PythonRunner.run(PythonRunner.java:74)
at org.python.pydev.debug.ui.launching.AbstractLaunchConfigurationDelegate.launch(AbstractLaunchConfigurationDelegate.java:99)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:923)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1126)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

相关数据是:

eclipse.buildId=I20100608-0911
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=pl_PL
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.java.product

 

【解决过程】

1.从:

http://code.google.com/p/grinderstone/source/browse/trunk/project/com.googlecode.grinderstone/src/com/googlecode/grinderstone/debug/ui/launching/GrinderLaunchConfigurationDelegate.java?r=109

中,倒是找到了源码了:

/**
 * Class preparates configuration for launching.
 * 
 * @author Borislav Andruschuk
 * @since GrinderStone 1.0
 */
public class GrinderLaunchConfigurationDelegate extends AbstractLaunchConfigurationDelegate {


    @Override
    protected String getRunnerConfigRun() {
        return GrinderRunnerConfig.RUN_GRINDER;
    }

    @Override
    public void launch(ILaunchConfiguration conf,
                       String mode,
                       ILaunch launch,
                       IProgressMonitor monitor) throws CoreException {
        if (monitor == null) {
            monitor = new NullProgressMonitor();
        }

        monitor.beginTask("Preparing configuration", 3);
        try {
            PythonRunnerConfig runConfig = new GrinderRunnerConfig(conf, mode);

            monitor.worked(1);
            try {
                PythonRunner.run(runConfig, launch, monitor);
            } catch (IOException e) {
                Log.log(e);
                throw new CoreException(GrinderStonePlugin.makeStatus(IStatus.ERROR,
                                                                      "Unexpected IO Exception in Pydev debugger",
                                                                      null));
            }
        } catch (final InvalidRunException e) {
            handleError(launch, e);
        } catch (MisconfigurationException e) {
            handleError(launch, e);
        }
    }

但是无助于问题解决。

2.后来参考:

PyDev for Eclipse

得知,升级PyDev到1.6.1,即可解决此问题。

 

【总结】

很多东西,如果有问题,不妨尝试使用最新版本。往往会有意外收获。

 

注:截止2013-01-02,PyDev,最新版已经是 2.7.0了。



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量