Networktables in PyDev

I am trying to write a test program that will allow the RoboRIO to communicate with a Raspberry Pi 3 using networktables, specifically the pynetworktables from the RobotPy project. As a regular Java team/developer, I have Eclipse installed on my laptop, and I have added the PyDev plugin.

I have successfully installed Python, pip, pynetworktables, and PyDev. I have set up a PyDev project in Eclipse, and successfully constructed a src folder, a package, and modules. I successfully ran a “Hello world” program using one of these modules.

My problem is that when I try to import networktables using the example line shown in the RobotPy networktables documentation, it gives me an error,

“Unresolved import: NetworkTables”

I am pretty sure that I need to somehow add pynetworktables to my build path (or whatever the python equivalent of a build path is), but I am at a loss for how to actually do this. Right-clicking on the project doesn’t offer me any ‘build path’ type options, and even if it did, my experience in python is minimal enough that I’m not exactly sure how I would find/add the pynetworktables. Has anyone done this/can anyone offer some direction here?

There are two things you need to do.

pydev is a bit weird sometimes. The fun part is even if pydev says that there’s an import error, it’s not like Java – executing your code might still work! Because python isn’t a compiled language, pydev is only guessing based on the inputs it has.

I did figure it out! It turns out that while my interpreter was configured properly, the ‘default’ interpreter in PyDev was going to the 2.7 version of Python that shipped with my computer and not the 3.6 I manually added to my pythonpath. Oops:eek: