Eclipse PyDev 完成挂起(再次)

发布于 2024-12-05 11:20:37 字数 998 浏览 1 评论 0原文

我在 Eclipse 中使用 PyDev 作为我的 Python 编辑器。就功能集而言,它很好。一切工作正常,除了一件非常烦人的事情:

代码完成本身工作得很快。当我按 Alt+Space 时,窗口几乎立即弹出,所有选项都在那里。顶部的选项被选中。 然后麻烦就来了。大约 5-10 秒后才会出现详细说明。在此期间,CPU 一直在最大负载下工作,并且接口没有响应。所有处理器都被 Eclipse Java 进程消耗(生成的 Python 进程似乎空闲)。然后会弹出一个黄色窗口,其中包含的只是所选函数/变量的 Python 代码。所有连续的详细信息都会立即显示。当我关闭完成窗口时(例如接受选项之一并再次要求完成),该过程会重复。这让我发疯。

到目前为止我已经尝试过:

  • 创建一个全新的工作区,
  • 从头开始创建一个 Eclipse/PyDev 项目,
  • 调整 JVM 以确保它有足够的内存,
  • 确保选择正确的 JVM(最新的 Oracle JVM 可用),
  • 确保Python 进程与 Java 实例自由通信(我读到了可能存在的问题,但这似乎不是问题所在)。
  • 确保所有安装的插件都是最新的。

我使用的版本是 Eclipse Helios,因为上次我检查某些扩展尚未移植到最新版本。

有没有人观察到类似的问题?有人能够绕过它吗?关于如何调试它并可能提交合理的错误报告的一般想法?其他值得检查的事情。

还有比完全关闭完成功能更温和的解决方法吗?

谢谢!

编辑:

我还注意到 HTML/CSS 编辑器中类似弹出窗口的问题。它看起来有点相似(一个黄色的窗口,里面有一些文字),而且也需要很长时间才能显示。真的不知道这是否相关,但可能是。

编辑(2):

好的,不,我已经开始全新安装最新的 Eclipse Indigo,除了 PyDev 之外没有任何其他插件,问题仍然存在。看来我得寻找一个新的 IDE 了。

I'm using PyDev in Eclipse as my Python editor. It's fine in terms of feature set. Everything works fine except for one very annoying thing:

Code completion itself works fast. When I press Alt+Space, the window pops out almost instantly and all the options are there. The option at the top is selected. Then comes the trouble. The detailed description won't appear until about 5-10 seconds. All this time CPU is working at maximum load and the interface is not responding. All the processor is consumed by the Eclipse Java process (the spawned Python process seems idle). Then a yellow window pops up, and all it contains is just a Python code of a selected function/variable. All consecutive details are displayed instantly. The procedure repeats when I close the completion window (for example by accepting one of the options and asking for completion again). This drives me crazy.

I've tried so far:

  • creating a whole new workspace,
  • creating an Eclipse/PyDev project from scratch,
  • tweaking JVM to make sure it has loads of memory,
  • making sure the right JVM is chosen (the latest Oracle JVM available),
  • making sure Python process communicates freely with the Java instance (I read about possible problems with that, but it seems not to be the issue).
  • making sure all the installed plugins are up to date.

The version I use is Eclipse Helios, because the last time I checked certain extensions weren't yet ported to the latest one.

Has anyone observed a similar issue? Was anyone able to get around it? General ideas on how to debug it and file a sensible bug report possibly? Other things worth checking for.

Any workaround less drastic than turning completion off completly?

Thanks!

EDIT:

I've also noticed a problem with a similar popup window in HTML/CSS editor. It looked somewhat similar (a yellow window, with some text inside) and it also took ages to display. Don't really know if that is related, but could be.

EDIT(2):

Ok, No I've started with a fresh install of the newest Eclipse Indigo, without any additional plugins apart from PyDev and the issue remains. Seems like I'll have to look for a new IDE.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一身仙ぐ女味 2024-12-12 11:20:37

您使用什么版本的 Java?

如果您使用的是 Windows 7,则更高版本的 Java(我认为 6+)将默认使用 IPv6。
这可能是导致问题的原因,因为 Python 可能需要 IPv4。

不管怎样,由于我遇到了这个问题,我尝试禁用

  • PyLint
  • 代码分析

,但它仍然挂起。

Pal 关于“ipv4 利用”的回答让我想起了我通过“首选”IPv4 解决的另一个问题。

请参阅http://docs.oracle.com/javase/1.4 .2/docs/guide/net/ipv6_guide/

您想要做的是编辑 eclipse.ini 并在 vmargs 部分添加“-Djava.net.preferIPv4Stack=true”

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
...
-vmargs
-...
-Djava.net.preferIPv4Stack=true
...

我不再挂起。

What version of Java are you using?

If you are on Windows 7, later versions of Java (I think 6+) will default to IPv6.
This is probably causing the problem as Python maybe wanting IPv4.

Anyway, since I had this problem I tried disabling

  • PyLint
  • Code Analysis

but it was still hanging.

Pal's answer about "ipv4 utilization" triggered my memory about another problem I had solved by "preferring" IPv4.

See http://docs.oracle.com/javase/1.4.2/docs/guide/net/ipv6_guide/

What you want to do is to edit your eclipse.ini and add "-Djava.net.preferIPv4Stack=true" in the vmargs section

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
...
-vmargs
-...
-Djava.net.preferIPv4Stack=true
...

I no longer get hangs.

近箐 2024-12-12 11:20:37

您是否有机会提供实现这种情况的代码(并将其添加到错误报告中,请参阅:http:// /pydev.org/about.html 链接)?

我每天都在一些非常大的项目中使用 PyDev,并且没有这个问题,因此,这可能是代码中的某些特定构造或场景 - 或者也许您只是没有为 Eclipse 提供足够的内存(这将使垃圾收集器工作更多),在这种情况下,请查看:什么是最佳 JVM 设置Eclipse?(具体来说,提高你的 -Xmx 标志,尽管你也可以使用那里的其他技巧)。

如果您无法提供可重现的场景,另一个选择是获取探查器(即:YourKit java探查器有 15 天的免费期,这在这种情况下会有所帮助),在探查器中运行该用例并传递快照在这种情况下发生了什么(如果是这种情况,请在 pydev.org 打开错误报告,我可以在那里为您提供帮助)。

Is there any chance you can provide the code that's making that happen (and add it to a bug report see: http://pydev.org/about.html for links)?

I use PyDev daily with some very large projects and don't have that problem, so, it may be some specific construct or scenario in your code -- or maybe you just haven't given Eclipse enough memory (which would make the garbage collector work much more), in which case, take a look at: What are the best JVM settings for Eclipse? (in specific, raise your -Xmx flag, although you can probably use the other tips there too).

If you can't provide a reproducible scenario, the other choice would be getting a profiler (i.e.: YourKit java profiler has a 15 days free which would help in this case), running that use-case in the profiler and passing a snapshot of what's happening in this situation (if that's the case, please open a bug report at pydev.org and I can help you there).

铜锣湾横着走 2024-12-12 11:20:37

我从 pydev.org 常见问题解答中得到了这个,它对我来说效果很好。

当我执行代码完成时,PyDev 挂起,我该怎么办?

PyDev 的大部分工作都在 java 端完成,但有些信息只能从 python 端获取(主要是内置函数),因此,为了获取这些信息,PyDev 创建一个 shell 并通过套接字与其进行通信。

发生这种情况时的主要问题是:

  1. 有防火墙阻止与 shell 的通信

  2. 在 Linux 中,某些内核不允许使用 ipv4,这可能会使PyDev 失败。

要启用它,请执行以下操作: echo 0 > /proc/sys/net/ipv6/bindv6only

  1. 连接超时太小。

这取决于代码完成首选项中的“连接到 shell 的超时”(窗口 > 首选项 > PyDev > 代码完成)

如果不起作用,请报告错误(另外,检查错误日志中是否有任何内容(窗口 > 显示视图 > PDE 运行时 > 错误日志)以及 eclipse '.log',它位于工作区位置的 .metadata 文件夹中。

I got this from pydev.org FAQs and it works fine for me.

When I do a code-completion, PyDev hangs, what can I do?

PyDev does most of its things in the java side, but some information can only be gotten from the python side (mainly builtins), so, in order to get that info, PyDev creates a shell and communicates with it through sockets.

The main problems when that happens are:

  1. There's a firewall blocking the communication to the shell

  2. In Linux, some kernels do not allow ipv4 utilization, which may make PyDev fail.

To enable it, do: echo 0 > /proc/sys/net/ipv6/bindv6only

  1. The timeout to connect is too smal.

It depends upon the "Timeout to connect to shell" in the code-completion preferences (window > preferences > PyDev > Code completion)

If nothing works, please report a bug (also, check if there is anything on the error log (window > show view > PDE Runtime > Error log) and on the eclipse '.log', which is located at the .metadata folder of the workspace location.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文