PyDev is acting stupid on python methods. # #UndefinedVariable - pydev

Since PyDev does not have a support page I will complain about it here.
Take for example the redis module and do the following method.
import redis
pubsub = redis.pubsub(ignore_subscribe_messages=True)
PyDev then has no clue what pubsub you are talking about, an instance variable of redis, it's method or an instance of another class.
Is there a way to get PyDev to now which pubsub I'm talking about or is this an issue the PyDev team needs to solve?

You can ask PyDev to use a python shell to analyze redis or you can provide stubs for it.
See: Forced Builtins in http://www.pydev.org/manual_101_interpreter.html to know how to ask it to analyze it through a shell and Predefined Completions in that same page to provide stubs.

Related

Using Saxon/C with Perl

The Saxon website says Saxon/C can be invoked from Perl, but I can't find any examples. The only thing I've found that interfaces to Saxon is one old Perl module (XML::Saxon::XSLT2) which uses Inline::Java and apparently is very slow. But I can find nothing that uses Saxon/C. Has anyone had any success in doing this who can share some tips?
we have not yet officially done the integration work needed to extend Saxon/C on perl it is still on our todo list. Therefore we currently don't support it. I don't know of anyone who has done this work as yet but I know it is can be done.
On the Saxon website we state that it is possible to create extensions in languages like Perl since Saxon/C has a C/C++ interface. Currently, we only have extensions for PHP and Python (available in the next release).
As a workaround you could run the transform command from Saxon/C using the exec function in Perl instead of the Java version, therefore avoiding the need to run Java VM.

configuring the interpreter for eclipse 4.6.0

I am trying to start a new PyDev Project and first need to setup the interpreter. The auto-config does not find a "valid interpreter". And so I must manual config. Perhaps someone with experience in this procedure knows of the specific name for the Interpreter Executable I am looking for. Thanks!
To get the interpreter you need to use, start the python interactive console in a shell and then do:
import sys; print(sys.executable)
The path printed is the interpreter you should use.
As a note, PyDev 4.6.0 is pretty old already, so, my suggestion would be upgrading to the latest release as many things were improved in the meanwhile.

PyDev can't see class from PyTables

I've installed pytables under windows 7 64 bit and it passes all the tests. Both python from command prompt and IDLE can successfully see the StringCol class, and even the python console in Eclipse can see it.
However, PyDev's autocomplete can't discover the class, and editor keeps displaying an error that says undefined variable: StringCol
Despite the error, the following code runs successfully in eclipse, using PyDev
from tables import *
if __name__ == '__main__':
a = StringCol(34)
print (a)
I've switched workspaces, created projects from scratch, deleted the pyc that contains the class. Nothing seems to help. How do I make pydev recognize the class which is obviously sitting where it is supposed to?
Have you configured the "forced builtins" in the interpreter. From the getting-started guide:
Additionally, you may add other libraries that you want to treat as
builtins, such as os, wxPython, OpenGL, etc. This is very important,
because PyDev works on the java side only with static information,
but some modules don't have much information when analyzed statically,
so, PyDev creates a shell to get information on those.

IPython starting ipclusters

I'm using this amazing IPython notebook. I'm very interested into parallel computing right now and would like to use MPI with IPython (and MPI4py). But I can't start a cluster with
ipcluster start -n 4
on Windows7. I just get back "failed to create process". If I use the notebook and start a cluster in the "Clusters" register it's all working fine. But with cmd (even with admin rights) I just get this message. Same with all attempts of using MPI (MPICH2). All path vars are set. Maybe this problem has no connection to Python at all...
I can't say anything about IPython's parallel features, but if you're having problems with MPI in Windows in general, I would offer these suggestions. I've had quite a few issues in the past in trying to get MPI working in Windows. The most convenient method for me in the past has been to use an OpenMPI Windows binary http://www.open-mpi.org/software/ompi/v1.6/. These are now only available in previous releases. And even then, you might have to try more than one before you find one that works. I don't know why, but the latest didn't work on my machine. The release before that one did, however. After this, you have to call mpicc and mpiexec from the Microsoft Visual Studio Command Prompt or it won't work (without a lot of other stuff).
After you have verified that MPI is working, you can try installing mpi4py separately and see if that works. In my experience, sometimes this has worked fine and sometimes I've had to wrestle with configurations. You might just try your luck with an unofficial, prepackaged binary (for example, http://www.lfd.uci.edu/~gohlke/pythonlibs/).
Hope this helps!

Is there a way to view commands run in the background in Eclipse?

I use Eclipse Helios for developing J2ME applications. I wanted to know if there was a way I could see the background/text-line commands that are executed for each click/action on the GUI (eg. Compile, Run, Creating a J2ME package). I am interested in it so I can run through the process using a script.
There is nothing specific that you can do to see all commands run in Eclipse. First, there is no one to one mapping between code being executed in Eclipse and java commands that you might run from the command line. So, even though you might be able to view individual commands in vim or Emacs, you won't be able to do this Eclipse.
However, there are some things that may help. There is a platform tracing facility that will print some trace messages to stdout. However, this is not widely used outside of core Eclipse projects so you won't be able to get full tracing on all commands. Also, this facility is not meant to be a general tracing facility, but really only for a few plugins that you are interested in. You can find more information about it here:
http://wiki.eclipse.org/FAQ_How_do_I_use_the_platform_debug_tracing_facility%3F
So, you will need to create a .options file in your Eclipse install directory with something like the following contents:
org.eclipse.platform/debug=true
org.eclipse.ui/debug=true
org.eclipse.core.runtime/debug=true
org.eclipse.core.resources/debug=true
org.eclipse.core.commands/debug=true
org.eclipse.core.filesystem/debug=true
org.eclipse.core.jobs/debug=true
These are a few of the low-level Eclipse plugins that will very likely contain some tracing information. However, without knowing more about what you are trying to do, it is hard to recommend specific plugins to trace.