Go to Post A constant awareness of safety is a plague I would welcome. - Alan Anderson [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-01-2017, 19:40
abigailthefox's Avatar
abigailthefox abigailthefox is offline
Registered User
FRC #1711 (Raptors)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: Traverse City
Posts: 60
abigailthefox has a spectacular aura aboutabigailthefox has a spectacular aura about
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 27-01-2017, 00:11
virtuald's Avatar
virtuald virtuald is online now
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Networktables in PyDev

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.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #3   Spotlight this post!  
Unread 27-01-2017, 13:52
abigailthefox's Avatar
abigailthefox abigailthefox is offline
Registered User
FRC #1711 (Raptors)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: Traverse City
Posts: 60
abigailthefox has a spectacular aura aboutabigailthefox has a spectacular aura about
Re: Networktables in PyDev

Quote:
Originally Posted by virtuald View Post
  • Make sure that your source file is in the 'pythonpath' in the pydev settings for your project
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
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 15:28.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi