Go to Post It's not about a team having lots of money to spend to travel the world to share FIRST but how the team draws the world into their FIRST experience. - Steve W [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 15-06-2016, 12:39
Brian Maher's Avatar
Brian Maher Brian Maher is online now
Questionable Decisionmakers
FRC #2791 (Shaker Robotics), FRC #1257 (Parallel Universe)
Team Role: College Student
 
Join Date: Apr 2014
Rookie Year: 2012
Location: Troy, NY; NJ
Posts: 476
Brian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond reputeBrian Maher has a reputation beyond repute
Re: The Python Alliance (Lightweight TBA Client in Python)

Good job, Tim.
Quote:
Originally Posted by tjf View Post
(Side note, this only properly works in Python 2.7 because of input() vs raw_input(). If anyone has a solution that works in both, I'd happily accept...)
A quick-and-dirty solution that comes to mind is writing your own input function with a try-except block:
Code:
def my_input(prompt):
     try:
          return raw_input(prompt) 
     except:
          return input(prompt)
An alternative, more sophisticated approach would be to check the Python version in your function. This Stack Overflow thread talks about how to use the Python version number in a program.

A similar method can be used for print() vs the print keyword, which should make it compatible with both Python 2.7 and 3.X.
__________________
2016-present, Mentor, FRC 2791 - Shaker Robotics
2016: Tech Valley SF (5236, 2791, 3624) and Quality, Finger Lakes SF (5254, 2791, 2383), Battlecry@WPI Winner (195, 2791, 501), Robot Rumble Winner (2791, 195, 6463)

2016-present, Mentor, FRC 1257 - Parallel Universe
2016: Mount Olive Winner (1257, 5624, 1676), Bridgewater-Raritan Finalist (1257, 25, 3340, 555) and GP, MAR CMP Winner (225, 341, 1257), Archimedes SF (4003, 4564, 5842, 1257), IRI Invite

2012-2015, Student, FRC 1257 - Parallel Universe
2015: Mount Olive QF (1257, 1811, 1923) and Safety Award, North Brunswick Finalist (11, 193, 1257) and Team Spirit and Safety Awards
2014: Clifton Winner (1626, 869, 1257), MAR CMP QF (1257, 293, 303)
2013: TCNJ Safety Award
2012: Mount Olive QF (204, 303, 1257)

Last edited by Brian Maher : 15-06-2016 at 18:41.
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 09:04.

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