Eclipse Oxygen freezes when writing with PyDev - python

I am trying to create a project using PyDev in Eclipse Oxygen, and whenever I start typing, Eclipse stops responding. It doesn't seem to be because of the completion, it works fine in Java projects and it's able to suggest import and other keywords. I'm typing a for loop when it freezes, I get about half way through the range keyword usually. I've restarted Eclipse several times and tried Java without issues. I'm running Java 1.8.0_144, Python version 3.6.2, and Eclipse version 4.7.0.
Any suggestions would be appreciated.
In the log file, this is the most recent error:
java.lang.RuntimeException: Attempt: 4 of 5 failed, trying again...(socket connected: still null) at org.python.pydev.core.log.Log.log(Log.java:54) at org.python.pydev.editor.codecompletion.shell.AbstractShell.startIt(AbstractShell.java:353) at org.python.pydev.editor.codecompletion.shell.ShellsContainer.getServerShell(ShellsContainer.java:232) at org.python.pydev.editor.codecompletion.shell.ShellsContainer.getServerShell(ShellsContainer.java:165) at org.python.pydev.editor.codecompletion.shell.AbstractShell.getServerShell(AbstractShell.java:222) at org.python.pydev.editor.codecompletion.revisited.modules.CompiledModule.createTokensFromServer(CompiledModule.java:372) at org.python.pydev.editor.codecompletion.revisited.modules.CompiledModule.<init>(CompiledModule.java:176) at org.python.pydev.editor.codecompletion.revisited.SystemModulesManager.getBuiltinModule(SystemModulesManager.java:332)
at org.python.pydev.editor.codecompletion.revisited.SystemModulesManager.getModule(SystemModulesManager.java:371)
at com.python.pydev.analysis.additionalinfo.AbstractAdditionalDependencyInfo.updateKeysIfNeededAndSave(AbstractAdditionalDependencyInfo.java:256)
at com.python.pydev.analysis.system_info_builder.InterpreterInfoBuilder.syncInfoToPythonPath(InterpreterInfoBuilder.java:160)
at com.python.pydev.analysis.system_info_builder.InterpreterInfoBuilder.syncInfoToPythonPath(InterpreterInfoBuilder.java:86)
at org.python.pydev.editor.codecompletion.revisited.SynchSystemModulesManager.synchronizeManagerToNameToInfoPythonpath(SynchSystemModulesManager.java:390)
at org.python.pydev.editor.codecompletion.revisited.SyncSystemModulesManagerScheduler$SynchJob.run(SyncSystemModulesManagerScheduler.java:261)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

Check the faq on that: http://www.pydev.org/faq.html#HowToFixCodeCompletion
As a note, the problem is that PyDev is not being able to connect to a shell for getting code-completion info. The usual culprit is some firewall blocking or a misconfigured localhost -- you may want to try to return 127.0.0.1 in the get_localhost() method in plugins\org.python.pydev\pysrc\_pydev_bundle\pydev_localhost.py or maybe ::1 if using ipv6 (if that fixes it for you or if you find a different solution, please let me know -- from time to time I see some different issue and I want to keep the faq updated regarding things still not explained there or update the code to workaround different issues).

You should check whether local socket connections are allowed in your firewall settings. You might even try to switch off the firewall to test if freezing still occurs. If not (or if you are on a machine with inet connection) you may allow local socket connections like this (and/or ipv6 equivalent):
iptables -I INPUT 1 -p all -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
Be aware that this allows all localhost communication attempts, if unsure check back with your administrator. If this solves your problem and there arise no other security issues, persist the changes with (OS dependent - on a Windows / OS-X System you want to use the appropriate administrative GUI)
/etc/init.d/iptables save

Related

ConnectionAbortedError: [WinError 10053] using socket and rsa encryption with pycryptodome [duplicate]

[2011-04-11 13:27:36 - ddmlib]An established connection was aborted by the software in your host machine
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(Unknown Source)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.write(Unknown Source)
at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
at com.android.ddmlib.Client.sendAndConsume(Client.java:573)
at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:349)
at com.android.ddmlib.Client.requestAllocationStatus(Client.java:419)
at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:840)
at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:808)
at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:767)
at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:635)
at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:42)
at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:563)
This problem can be simply solved by closing Eclipse and restarting it. Eclipse sometimes fails to establish a connection with the Emulator, so this can happen in some cases.
Checkout there might be two instances of Eclipse are pointing to same Android SDK...just keep one instance of Eclipse and try again...that's why you are getting Exception as "established connection was aborted by the software in your host machine"...go in details of android adb(Android Debug Bridge) you will get it...
I was getting these errors too and was stumped.
After reading and trying the two answers above, I was still getting the error.
However,I checked the processes tab of Task Manager to find a rogue copy of 'eclipse.exe *32' that the UI didn' t show as running. I guess this should have been obvious as the error does suggest that the reason the emulator/phone cannot connect is because it's already established a connection with the second copy.
Long story short, make sure via Task Manager that no other Eclipse instances are running before resorting to a PC restart!
If you develop in multiple IDE's or other programs that connect to AVD you should try closing them too.
Netbeans also can cause conflicts with eclipse if you set it up for NBAndroid.
I had the problem with multiple IDE. Closing Eclipse, killing from task manager or restarting didnt help. Just deleted the AVD and created it again.
SOLUTION :-
I was getting the same error as I was opening two eclipse window, so I close one eclipse window and run the app again. You will not get the error.
restart(close and start) the eclipse again if you have open only one eclipse window.
This problem may occur if you have two devices connected to the computer at the same time. Adb does not support reaching both devices via command/console. So, if you debug your app after connecting and disconnecting the second device you will most probably have this problem. One solution might be restarting adb and/or eclipse if necessary. It can be quite annoying sometimes and I am afraid there is no other solution to that.
This problem may also occur when you are opening Android Studio and Eclipse at once. Try to close one of them and it might solve your issue.
In My Case, I was running Android Studio and Eclipse at a time. AS and Eclipse were trying to communicate a device/emulator through adb.
Solution:
I closed Android Studio. Then I restarted Eclipse.
Hope this helps you :)
Close the emulator if already opened.
Right click on your project ->Run as -> run configurations -> Run.
After the emulator launched: Right click on your project ->Run as ->android project.
I encountered this issue on my Windows 7 64-bit development machine when running Android Studio 2.1.x and Android Studio 2.2.x side-by-side.
I had deployed an application via the 2.2.x instance the previous day and had left that IDE running. The next day I deployed a different application from the 2.1.x IDE and this is when I encountered the issue.
Shutting down both IDEs and then restarting the 2.1.x IDE resolved the issue for me.
Restarting the eclipse will solve the problem and kill the "adb disconnect" and then "adb kill-server"
On a Windows box, I wanted to avoid reboot and these did not work:
* /android/adt-bundle-windows/sdk/platform-tools/adb kill-server
* /android/adt-bundle-windows/sdk/platform-tools/adb start-server
So what did work to get adb running again without this error was
wait for the TIME WAIT to complete, which took multiple minutes. You can view the state of the ports and watch when to restart the debugger with this command: "PortQryV2/PortQry.exe -local" This tools is downloaded here: http://support.microsoft.com/?id=832919
force closing ports with "netsh int tcp reset"
The only thing that worked for me (under windows) was to reopen the IDE as administrator. All worked smoothly after that.
I solved this problem by closing Eclipse and restarting it again. Eclipse sometimes fails to establish a connection with the Emulator/device, so this can happen sometimes.
Running Eclipse Luna and using WifiADB app on my phone I started getting this error when Running my app from Eclipse. Oddly, in Indigo (I installed Luna last night) it was working fine.
The problem for me was I had the phone connected to the PC to charge it, and even when running a .bat script to kill ADB it appeared that a second instance was started when Run. Plugging the phone into the monitor to charge when debugging over wifi solved it. I need to debug on wifi sometimes to test my app stopping/starting on power state change.
Of course it reasonable to assume (highly likely) I've just not set Luna up the same.
This problem appear if two software use same port
generally Android studio use the port 5037
try to close the port by cmd according to your operating system
then reboot your Android studio or your Eclipse
I was having this problem.
Things I tried:
Restart Eclipse
Restart Eclipse & Kill adb as mentioned here.
Restart Machine & Open Eclipse
This is what worked for me
Powered off (pulled plug) my android device, Restart Machine, Power
on android device.
Hope this helps someone!
Close Eclipse
Open Task Manager and kill adb.exe
Start Eclipse
It should work.

Running an opencv based python script on a remote server with ssh forwarding from my macbook gives me an error

I am trying to run a python script on a remote server, which includes displaying images. The image does not get displayed and I get an error Gtk-WARNING **: cannot open display:
I have checked posts where they suggest editing the flags in sshd_config and also setting the DISPLAY variable manually. But, none of that seems to be working for me.
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no
XAuthLocation /usr/X11/bin/xauth
Running xclock or xeyes also gives me errors.
Edit: I used ssh -X and ssh -Y to ssh into the server, neither worked
Solution: Restart after installing XQuartz
After looking through multiple posts and trying to make it work, I realised that after installing XQuartz, the user is required to restart the machine. It allows to set the correct environment variables (like DISPLAY). It works for me now after having restarted.
Alternative
However, in case you face a similar problem, not stemming due to the restart issue, I found an alternate way as suggested in the following link:
https://uisapp2.iu.edu/confluence-prd/pages/viewpage.action?pageId=280461906

Python/Flask: Application is running after closing

I'm working on a simple Flask web application. I use Eclipse/Pydev. When I'm working on the app, I have to restart this app very often because of code changes. And that's the problem. When I run the app, I can see the frame on my localhost, which is good. But when I want to close this app, just click on the red square which should stop applications in Eclipse, sometimes (often), the old version of application keeps running so I can't test the new version. In this case the only thing which helps is to force close every process in Windows Task Manager.
Will you give me any advice how to manage this problem? Thank you in advance.
EDIT: This maybe helps: Many times, I have to run the app twice. Otherwise I can't connect.
I've faced the same problem and solved it. I think it may help.
When we run a flask based site locally it is assigned to a TCP port: 5000 and the Default IP: 127.0.0.1:5000
Sometimes TCP connection remains even after closing the program or terminating the code. So, The idea is kill the TCP connection. You can do it from command-prompt(cmd)
Two Steps to Follow:
1. See the Process ID(PID) for the running TCP connection.
Go to cmd and type:
netstat -ano
Kill The Process By PID. Command for this: taskkill /f /im [PID]. Example is showed bellow.
taskkill /f /im 7332
I've had a very similar thing happen to me. I was using CherryPy rather than Flask, but my solution might still work for you. Oftentimes browsers save webpages locally so that they don't have to re-download them every time the website is visited. This is called caching, and although it's very useful for the average web user, it can be a real pain to app developers. If you're frequently generating new versions of the application, it's possible that your browser is displaying an old version of the app that it has cached instead of the most up to date version. I recommend clearing that cache every time you restart your application, or disabling the cache altogether.
This actually shouldn't happen with the latest versions of PyDev (i.e.: since PyDev 3.4.1: http://pydev.org/history_pydev.html, PyDev should kill all the subprocesses of the main process).
So, can you check which PyDev version are you using?
If you're in the latest version of PyDev, you can use Ctrl+Shift+F9 to terminate/relaunch by default.
But as you're dealing with flask, you should be able to use it to reload automatically on code-changes without doing anything by setting use_reloader=True.
I.e.: I haven't actually tested, but its documentation says that you can set the reload flag for that run(use_reloader=True) -- and PyDev should even be able to debug it (I'll take a better look and improve the PyDev docs on that area later on).

Why does django jython connection to a MySQL database give a "Communication Link Failure"?

I'm trying to convert a django / cPython app to run as a Tomcat WAR using Jython. We are using a mysql database (MySQLdb in cPython / mysql-connector-java-5.1.15-bin.jar in jython). I have changed the DATABASE_ENGINE between the two configurations. The app runs great with cPython (after I disabled SELinux limitations on http connections to a database). The front page, images, and static content work in the jython. However, when I request a page that hits the database, it seems to hang for a while, then returns with:
Communications link failure
The last packet sent successfully to
the server was 0 milliseconds ago. The
driver has not received any packets
from the server. [SQLCode: 0],
[SQLState: 08S01]
Has anyone seen this before? I don't see any recent discussions of this type or problem. I'm using django 1.2.5, jython 2.5.2. I've tried running the Java app under Fedora (jre-1.6.0-openjdk.x86_64) and Windows (Java(TM) SE Runtime Environment (build 1.6.0_23-b05)). Same behavior. I've also tried both mysql-connector-java-5.1.15-bin.jar (the latest version) and mysql-connector-java-5.1.10-bin.jar ("extensively tested" according to http://packages.python.org/django-jython/database-backends.html). None of the various configurations affect the behavior.
How can I solve it or where should I look next?
I found the mistake. In hindsight, it's obvious. I made a type-o in the IP address of the database server, but only in the configuration file on the jython branch. As a result, the Jython instance hung while the cPython instance didn't. Found the error when I merged the two into a single settings.py (using "if os.name=='java'" to make the necessary jython changes.
So . . . What's the correct protocol here? Should I delete the question or leave it up in case someone else makes the same type of mistake I did?

Determine killer of process

I got a python program running as a windows service which does in my opinion catch all exceptions. In my development environment I cannot reproduce any situation, where no exception is logged, when the program crashes. Except 2 cases: the program is killed via Task Manager or I power off the computer.
However, on the target environment (Windows 2000 with all necessary libraries and python installed), the windows service quits suddenly ca. 4 Minutes after reboots without logging any Exception or reason for the fail. The environment was definitely not powered off.
Does anybody have a suggestion how to determine what killed the python program?
EDIT: I cannot use a debugger in the target environment (as is it is productional level). Therefore I need a way to log the reason for the failure. So, I am looking for tools or methods to log additional information at runtime (or failure time) which can be used for post-mortem analysis.
You need to give more information like "Is your program multi-threaded ?" Does the code depend on the version of Python interpreter you are using, or any imported modules used not present in the target environment ?
If you have GDB for Windows, you can do "gdb -p pid" where "pid" is the pid of the python program you are running. If there is a crash, you can get the back trace.
You may want to check also the following tools from sysinternals.com (now acquired by MSFT):
http://technet.microsoft.com/en-us/sysinternals/bb795533
such as ProcDump, Process Monitor or even Process Explorer (yet less adapted than the previous ones).
You may also be able to install a lightweight debugger such as OllyDbg, or use Moonsols's tools to monitor the guest VM's process if you happen to have this in a virtualized environment.

Categories