Eclipse PyDev is throwing false errors - eclipse

I updated PyDev (Eclipse) yesterday and now it is telling me that None, name and other reserved words/builtin functions are invalid, but the script runs just fine. I have read on this forum that the problem deals with incorrectly importing the built-ins. I have tried changing the interpreter and re-adding it but no luck. Can somebody help me please?
The errors:
Undefined variable main
Undefined variable None
Undefined variable int
Undefined variable eval
I am running eclipse Juno and PyDev 2.7.4. also, I notice that the errors only appear after the PyDev code analysis ends.

This happened to me as well, the problem was that eclipse couldn't find python.
My fix:
in Eclipse:
Window > Preferences > PyDev > Interpreter - Python
The settings here were blank. I clicked 'Auto Config', which suggested to me the path to python. I chose it, restarted eclipse, and problem solved.

Well, I see nobody has come up with some idea. I found out by myself so I'm posting how I solved it here; maybe it'll help somebody:
The problem was that I had recently changed my local machine's name, but PyDev was still looking for localhost when it tried to connect to the Python Shell. I just updated the files in my operating system containing the hostname, and voila (the automatic wizard did not update all the files for some reason, so I had to do it manually).

Related

Error message failure and crash when using pydev embedded jython interpreter

I have a strange problem when using Pydev on my work machine (others at work have the same issue). It does not occur when I do this at home, which makes me think it's something to do with the environment at work. We are running Windows 7.
I am using Pydev 3.9.2 but the same thing happens with earlier versions. It occurs with all versions of Eclipse after 3.7. The problem is this. When I create a jython console (the one running in the Eclipse VM), the error output doesn't work. If I type an invalid python command, there is no output on the console. It just appears that the command worked. If I type a command such as "print 100", the output prints as you would expect.
The second problem is that if I hit the red square which is supposed to remove the console window, Eclipse crashes. There are no errors or any indication of what is going wrong.
I have tried different versons of eclipse, different versions of Pydev, different machines and it doesnt make any difference.
Has anyone seen this? I've tried everything I can think of to debug this issue so any help is appreciated.
thanks,
brian
Unfortunately those quirks are expected...
The internal console in Eclipse is mostly a developers SDK for experimenting with Eclipse itself and is not meant as a general shell (you should configure an interpreter and use it for that).
I don't have plans on improving on that situation (there's already a multi-year backlog on PyDev and this isn't really critical), but if you'd be willing to spend some time and fix those issues, pull requests would be definitely welcome -- see: http://pydev.org/manual.html for details on getting the code and setting up the environment.

Python module will not run correctly from command prompt

This goes out to anyone who is well versed in the Eclipse IDE and or PyDev perspective plug-in who is willing to offer some technical support.
I am trying to write a python module that must take in arguments from the command prompt with sys.argv function calls. Rather than printing out the correct output when I enter E:\ ... \src>program.py arg1 arg2, all that happens is a new command line (E:\ ... \src>) is output and the Eclipse IDE window flashes orange without any code in my python module actually being executed. Also, if I close the Eclipse IDE and try to run program.py, it will just open Eclipse again and open my program in a new tab.
I'm confused as to why it is not working now when just last week it was working perfectly while testing another program that took in arguments from the command prompt by sys.argv function calls. My question for everyone is whether or not you are aware of any settings that may have been altered by updates, etc. that could cause this problem; or has anybody out there ever run into this problem and figured out how to resolve it? I have already checked my PATH variable, so that is not the problem :-(. Any help you can provide would be greatly appreciated ... thank you.
OS: Windows 8.1 Pro / Eclipse ver.: Kepler (4.3) / Python ver.: 3.3.2
I answered my own question in the comment above. I just had to wait to post an answer due to the fact that I just created a stackoverflow account yesterday.

Setting up JDK environment variables for Eclipse and Command line

I had Java working with Eclipse but I had to set up up Javac on the command line. I set the environment variables shown below but it doesn't work. Eclipse has now also stopped working.
Any help would be great!
Thanks!
Ok so I went a bit crazy and uninstalled/reinstalled loads of different jdk's. Finally one installed completely when I saved it directly to my C drive. I updated my environment variables for eclipse and for my command prompt and voila! Java is now working! I guess the problems with the space between Program Files will haunt me forever so I shouldn't save anything there anymore.

No Java console output in Eclipse; works with PyDev

I have both a Java and a PyDev project in one workspace. When I run the PyDev project (either the main script with Run > Run As > Python Run or its associated unit test with Python unit-test), the console output looks fine. However, when I switch to the Java project, open the main class, make sure the cursor focus is in the main class, and run it with Run > Run as > [my run config], no output shows up in the console, stdout or stderr. I've tried with Run/Debug > Console > Fixed width console checked and unchecked, similarly for Limit console output. "Allocate console" is check in [my run config].
I have tried redirecting output to a file in my run configuration, but the log file is empty after a run; thus, I suspect stdout/stderr are being trapped somewhere. I suspect that it is PyDev causing the issue because when I run the Java project, this exception reliably shows up about 6 times in the error log:
Launch shortcut 'org.python.pydev.debug.ui.launchShortcut.python.unittest' enablement expression caused exception. Shortcut was removed.
stacktrace:
org.eclipse.core.runtime.CoreException: No property tester contributes a property org.python.pydev.debug.ui.python_type to type class org.eclipse.ui.part.FileEditorInput
at org.eclipse.core.internal.expressions.TypeExtensionManager.getProperty(TypeExtensionManager.java:123)
at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:96)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateOr(CompositeExpression.java:68)
at org.eclipse.core.internal.expressions.OrExpression.evaluate(OrExpression.java:21)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.AndExpression.evaluate(AndExpression.java:29)
(... and so on)
Additionally, printing from a Java program in a different workspace that only has Java projects works fine.
I tried uninstalling PyDev and restarting Eclipse, but I'm still having the same issue. I still have those errors after reinstalling PyDev, too.
Has anyone run into this issue before, or know of a way to fix it?
Well, I feel like an idiot; turns out, I had redirected stdout/err to a log file that I had long since forgotten about, and stuck somewhere difficult to find.
I ran into the same problem so I did some research. Seems like there was an old issue (2006-2008), but it was resolved by adding an option to the launch configurations to allocate a console. This is available from the Run -> Debug Configurations menu option, Common tab. Perhaps this is simply unchecked after the PyDev install?
If this is a new bug, there were two possible workarounds suggested:
Set up debug launch configuration that uses remote debugging instead of local debugging.
Use a buffered writer to System.out.
Here are the threads for reference:
Eclipse bug - https://bugs.eclipse.org/bugs/show_bug.cgi?id=122429
Workaround thread - java.io.Console support in Eclipse IDE

Perl syntax is not highlighted

I have Eclipse SDK Version: 3.5.2 with EPIC 0.5.46 installed on Ubuntu Linux. I was writing some Perl code which I could run/debug correctly. The syntax was always highlighted. recently I had to add one *.pl file to my project and debug it. However, for some reason, the code is not being highlighted. What might be the reason for this behavior? My guess was that maybe there is some issue with Eclipse/EPIC adding/importing new files to the existing project but I'm not sure. Please consider even basic mistakes with Eclipse/EPIC configuration and projects management since I'm new to it. Thanks!
It seems that I found the problem which was preventing my Perl code from being highlighted. I've noticed that in the first lines of my .pl file, there is a commented line which include a weird ? symbol as appears on the screenshot below:
The moment I removed this symbol, all the code became highlighted! So it seems that there was some issue with text encoding which prevented Eclipse ho highlight the coded correctly.
You should right-click the file and then open with "epic perl editor", then everything will be fine!