audiohacked / python-pyBusPirate

Library for the Dangerous Prototypes Bus Pirate
http://dangerousprototypes.com/docs/Bus_Pirate
GNU General Public License v2.0
39 stars 12 forks source link

Patch needed to work on my system #1

Closed JohnDMcMaster closed 11 years ago

JohnDMcMaster commented 14 years ago

I'm not terribly familiar with Python, I imagine maybe some of this is due to me running an older version. Might be nice so others using systems like mine can use it since its such a trivial patch. System: CentOS 5.4, Python 2.4.3. Its getting somewhat mangled by formatting here, let me know if you'd like to e-mail or something.

From d6d7ad8952bca26de31e588cbf7596501d39b288 Mon Sep 17 00:00:00 2001
From: John McMaster <JohnDMcMaster@gmail.com>
Date: Sat, 13 Mar 2010 18:44:38 -0500
Subject: [PATCH] Python compatibility

---
 pyBusPirate/BinaryMode/I2C.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pyBusPirate/BinaryMode/I2C.py b/pyBusPirate/BinaryMode/I2C.py
index cc75a66..49d0764 100644
--- a/pyBusPirate/BinaryMode/I2C.py
+++ b/pyBusPirate/BinaryMode/I2C.py
@@ -20,11 +20,11 @@ You should have received a copy of the GNU General Public License
 along with pyBusPirate.  If not, see <http://www.gnu.org/licenses/>.
 """

-from .BitBang import BBIO
+from BitBang import BBIO

 class I2CSpeed:
-       _50KHZ = 0b000
-       _5KHZ = 0b001
+       _50KHZ = 0x00
+       _5KHZ = 0x01

 class I2CPins:
        POWER = 0x8
-- 
1.5.2.1
corywalker commented 14 years ago

I believe I had to do something similar to this to get mine working, too. The author went a little crazy with relative imports and couldn't resist adding semicolons to the ends of lines. :)

audiohacked commented 11 years ago

I wrote this library back when I first learned how to program Python.....

audiohacked commented 11 years ago

Original Poster is using a very old version of python.