?

Log in

recent stories superwonderfulous peoples pick a day, any day! who, me? go back in time! go back in time! move boldly ahead! move boldly ahead!
Python help, please!! - Ldy, the lemony, ligerish ducttaparian's Magic Treehouse of Lost Thoughts
A classy broad's life... with footnotes.
ldy
ldy
Python help, please!!
OK, I'm hoping one of my geekariffic friends can help me here, because I sucked at Python* even before I forgot most of what I knew.

I own a gowear fit body monitoring device. It tracks calories, activity level, steps, etc. I also have a device that gives me real-time feedback from this device. Haven't used it in awhile, but I'd like to play with it again.

Now, it so happens that the people who manufacture this product are greedy blankity-blanks who require you have a subscription to their online monitoring software to use it. But I don't need the software! I don't want the software! And you never bloody told me I'd NEED the software (which is why I bought the feedback device).

Anywho, the devices won't work after the memory is full without having an ongoing online subscription. So someone developed a hack to clear the memory. Unfortunately, I can't get it to work. I've followed the instructions-- I've got python and the numpy libraries installed on a Win 32 system running XP Pro. I dropped bmhack into the python26 folder for ease of use. But when I try to call it with python.exe bmhack-718b.py --fromSerial COM7: --clear (or even when I leave the variables out, which should give me help information) I get the following error:

File "bmhack-z718b.py", line 27, in
import serial
ImportError: No module named serial

The information is here:
http://bodybugglinux.blogspot.com/

(Specifically, here and here:
http://bodybugglinux.blogspot.com/2009/07/command-line-extraction-tool.html
http://bodybugglinux.blogspot.com/2009/07/memory-clear-ability.html )

The actual python script (bmhack-z718b.py) is here:
http://www.mediafire.com/?sharekey=26cf7e726ccc34f061d4646c62b381cbfe370e2ca4df676ac95965eaa7bc68bc

I've tried mucking with different characters, spacing, etc., but I'm getting nowhere. I'm certain the drivers were installed, and I'm certain it's on COM7 (my computer recognizes the device). Any clues?

Any help would be deeply appreciated :)


* I "did badly" at the "programming language." Don't go there, gutterbrain! ;)

I'm feeling all kinds of: optimistic optimistic

14 tall tales or Tell me a story
Comments
lomer From: lomer Date: December 14th, 2009 11:48 pm (UTC) (permalink)
I thought you were asking for MONTY Python help. I'm of no use when it comes to computer Pythons.
ferretsofglory From: ferretsofglory Date: December 15th, 2009 12:02 am (UTC) (permalink)
was hopin for Monty. I'm better at that :)
hitchhiker From: hitchhiker Date: December 15th, 2009 12:09 am (UTC) (permalink)
you need to install pywin32 and pyserial first.
ldy From: ldy Date: December 15th, 2009 06:38 am (UTC) (permalink)
You, sir, rock; but you know that :)

One step closer, anyway.

C:\>c:\python26\python.exe bmhack-z718b.py --fromSerial COM7: --clear
PIL library not found.  ToImage() func unavailable
THIS CODE IS DECLARED BY THE AUTHOR TO BE IN THE PUBLIC DOMAIN.
NO WARRANTY EXPRESSED OR IMPLIED OF ANY KIND IS PROVIDED.
Traceback (most recent call last):
  File "bmhack-z718b.py", line 1179, in 
    sys.exit(main())
  File "bmhack-z718b.py", line 1100, in main
    ser = OpenSerial(dopts["--fromSerial"])
  File "bmhack-z718b.py", line 88, in OpenSerial
    ser.open()
  File "c:\python26\lib\site-packages\serial\serialwin32.py", line 53, in open
    raise SerialException("could not open port %s: %s" % (self.portstr, ctypes.W
inError()))
serial.serialutil.SerialException: could not open port COM7:: [Error 5] Access is denied.

hitchhiker From: hitchhiker Date: December 15th, 2009 11:24 am (UTC) (permalink)
PIL: http://www.pythonware.com/products/pil/

as for the serialexception, try running the script as Administrator and see if that helps.

also read http://www.ni.com/support/serial/verhyper.htm and http://forums.adafruit.com/viewtopic.php?f=19&t=13421

basically you're now running into a windows or hardware issue, not a python one
ldy From: ldy Date: December 15th, 2009 10:48 pm (UTC) (permalink)
You are correct, of course.

PIL didn't help. And I've already got Admin priv on this account. Echoing through hyperterminal confirmed that the COM port was the issue.

I poked around my event viewer and found the following, at approximately the times I was attempting access:

The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID
{BC866CF2-5486-41F7-B46B-9AA49CF3EBB1}
to the user NT AUTHORITY\LOCAL SERVICE SID (S-1-5-19). This security permission can be modified using the Component Services administrative tool.

However, while I could find the friendly name for the CSID in question in regedit (NSVCAP~1.EXE, it's apparently an nvidia networking thingamajig), I could not find the offending program by either friendly name or CSID in component services --> DCOM Config to change permissions.

Le sigh! Stupid rabbit hole ;)

Any other advice, oh wise one?
From: (Anonymous) Date: January 9th, 2010 02:45 am (UTC) (permalink)
HI. I have a bodybugg and am trying to clear the data using the hack.

I'm having the same problem with the program not being about to open the COM port.

Have you found an answer?

Good luck.
From: (Anonymous) Date: March 6th, 2010 08:22 pm (UTC) (permalink)
repost from the bmhack blog:

To fix the Access Denied problem:

in the script, right before
ser.open()

add this:

ser.close()

The script will look like this:

def OpenSerial(fname="/dev/ttyUSB0"):
ser=serial.Serial(fname,baudrate=921600,timeout=.01)
ser.close()
ser.open()

Works on Win7 64bit Ultimate... Didn't have to do this on Vista 64bit.
ldy From: ldy Date: March 28th, 2010 10:22 pm (UTC) (permalink)
Well, it did clear up the Access Denied issue. Now if it could only find the file... (sigh!)

THIS CODE IS DECLARED BY THE AUTHOR TO BE IN THE PUBLIC DOMAIN.
NO WARRANTY EXPRESSED OR IMPLIED OF ANY KIND IS PROVIDED.
Traceback (most recent call last):
File "C:\python26\scripts\bmhack-z718b.py", line 1180, in
sys.exit(main())
File "C:\python26\scripts\bmhack-z718b.py", line 1101, in main
ser = OpenSerial(dopts["--fromSerial"])
File "C:\python26\scripts\bmhack-z718b.py", line 87, in OpenSerial
ser=serial.Serial(fname,baudrate=921600,timeout=.01)
File "C:\python26\lib\site-packages\serial\serialutil.py", line 192, in __init
__
self.open()
File "C:\python26\lib\site-packages\serial\serialwin32.py", line 53, in open
raise SerialException("could not open port %s: %s" % (self.portstr, ctypes.W
inError()))
serial.serialutil.SerialException: could not open port COM7:: [Error 2] The syst
em cannot find the file specified.
ldy From: ldy Date: March 28th, 2010 10:27 pm (UTC) (permalink)
HA! I'm a dork. It assigned it a different COM port this time and I just didn't notice. Works with the fix (and the correct COM port!) :D
From: (Anonymous) Date: March 25th, 2010 02:53 pm (UTC) (permalink)

Did you get it working?

Idy,
Were you successful? I would love to know.

Best Regards,
Fly
ldy From: ldy Date: March 28th, 2010 10:28 pm (UTC) (permalink)

Re: Did you get it working?

Yes, yes I did :)

And thanks for jogging my memory-- I just went through a big move (and a lot of other changes in my life) and this little project got forgotten.
chezmax From: chezmax Date: December 15th, 2009 09:32 pm (UTC) (permalink)
Holy crap, that uses a tonne of requirements without specifying them.

as they said earlier, you need PIL and PySerial. :/
balfourryka From: balfourryka Date: July 21st, 2012 09:12 pm (UTC) (permalink)

Re:

14 tall tales or Tell me a story