Python code dilemma!

Joined
May 10, 2015
Messages
3
Reaction score
0
Points
1
Hi folks, i'm trying to run a python script in Terminal on my Mac, but i'm still learning and i can't make it work! Could one of you smart cookies give me any hints? Or tell me where i could find the answer?

It's python script to access the info stored on a Beurer bathroom weight scale via USB:
https://usb2me.wordpress.com/2013/02/03/beurer-bg64/

Other people seem to be using it no problems but I get this error message:

Traceback (most recent call last):
File “beurer64.py”, line 6, in
import usb.core
ImportError: No module named usb.core

I'm assuming the script can't find the device that i've plugged in via USB cable.
The device doesn't show up in Finder but it does show up in System Information.

Any idea what code i need to access a USB device?

[Apologies if this thread is posted in the wrong forum.]
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
That script was written for Linux. I would wager OS X does not have usb.core or usb.util (the next one in the script) installed.
Don't know if you could install them.
 
OP
S
Joined
May 10, 2015
Messages
3
Reaction score
0
Points
1
Thanks Craig. At least I know what to start looking into now.

Naively I thought that a script for Python would work on any system.
If I can find out how to replace the "usb.core" and "usb.util" bits, does anyone know if there's any chance of getting the rest to work on OS X? Or am I better off starting from scratch?

I hope not as I'm a complete beginner.
print 'Hello!' is about my level right now!
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
I doubt it, it's trying to import things like sys and pickle (?) which are not part of OS X.
This script is Linux specific. You might be able to port it but it'll be a lot of work.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top