Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9399

Odd caracteres

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <remi.druilhe@orange-ftgroup.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'filename:fname piece:py': 0.04; 'test,': 0.04; 'ubuntu': 0.04; '(using': 0.05; 'sys': 0.05; 'python': 0.08; '32-bit': 0.09; '__name__': 0.09; 'bind': 0.09; 'image-size:2**10': 0.09; 'linux.': 0.09; 'orange': 0.09; 'struct': 0.09; 'tty': 0.09; 'output': 0.11; 'read.': 0.11; 'error:': 0.12; 'float': 0.13; '"__main__":': 0.16; '#get': 0.16; '(0)4': 0.16; '42,': 0.16; '64,': 0.16; '__init__': 0.16; 'close(self):': 0.16; 'clues': 0.16; 'communicates': 0.16; 'ctrl-c': 0.16; 'from:addr:orange-ftgroup.com': 0.16; 'received:10.192.128': 0.16; 'received:10.192.128.46': 0.16; 'received:francetelecom.com': 0.16; 'received:francetelecom.fr': 0.16; 'received:ftrdsmtp1.rd.francetelecom.fr': 0.16; 'received:rd.francetelecom.fr': 0.16; 'sudo': 0.16; 'unpack': 0.16; 'skip:" 40': 0.16; 'def': 0.16; 'thanks,': 0.17; 'script.': 0.19; 'seems': 0.20; '(most': 0.21; 'math': 0.21; 'interface': 0.23; 'traceback': 0.25; 'changed': 0.25; 'parameters': 0.25; 'string': 0.26; 'skip:b 20': 0.26; 'tried': 0.27; 'skip:p 30': 0.28; '(see': 0.28; 'mode': 0.28; 'import': 0.29; 'script': 0.29; 'everyone,': 0.29; 'odd': 0.29; 'problem': 0.29; 'second': 0.29; 'skip:( 20': 0.30; 'consumption': 0.30; 'typeerror:': 0.30; 'class': 0.31; 'values': 0.31; 'print': 0.32; 'change.': 0.32; 'break': 0.33; 'to:addr:python-list': 0.34; 'there': 0.34; 'skip:# 10': 0.34; 'skip:& 10': 0.34; 'phone:': 0.35; 'last):': 0.35; 'try:': 0.35; '(with': 0.35; 'skip:" 10': 0.36; 'skip:o 20': 0.36; 'file': 0.36; 'data.': 0.36; 'device': 0.36; 'labs': 0.37; 'some': 0.37; 'but': 0.37; 'using': 0.37; 'think': 0.38; 'skip:& 20': 0.39; 'data': 0.39; 'except': 0.39; 'help': 0.39; 'skip:s 20': 0.39; 'under': 0.39; 'to:addr:python.org': 0.39; 'third': 0.40; 'easily': 0.61; 'from:no real name:2**0': 0.62; 'power': 0.62; 'content-type:multipart/related': 0.63; 'devices': 0.63; 'virus:src="cid:': 0.63; 'here': 0.66; 'serial': 0.71; 'physical': 0.78; 'bluetooth.': 0.91
X-MimeOLE Produced By Microsoft Exchange V6.5
MIME-Version 1.0
Content-Type multipart/mixed; boundary="----_=_NextPart_001_01CC4167.DFF5E339"
X-Mailer Evolution 2.32.2
Content-class urn:content-classes:message
Subject Odd caracteres
Date Wed, 13 Jul 2011 16:19:31 +0200
X-MS-Has-Attach yes
X-MS-TNEF-Correlator
Thread-Topic Odd caracteres
Thread-Index AcxBZ9/423LWBgSgSn6L0jtmaMipKw==
From <remi.druilhe@orange-ftgroup.com>
To <python-list@python.org>
X-OriginalArrivalTime 13 Jul 2011 14:19:30.0137 (UTC) FILETIME=[E120EC90:01CC4167]
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.983.1310567785.1164.python-list@python.org> (permalink)
Lines 177
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1310567785 news.xs4all.nl 23858 [2001:888:2000:d::a6]:41928
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9399

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello everyone,

I am using a Python script to get data from a BlueTooth device but it
seems there is some problem when reading from the interface on Linux.

I have a three devices (PowerSpy) that measure energy from an outlet (I
plug a computer on a PowerSpy that I plug on an outlet). This device
communicates using BlueTooth. So I connect my laptop via BT to get those
data (using : sudo rfcomm bind /dev/rfcomm0 powerspy_mac_address).

Then, I execute my Python script. This script reads data
from  /dev/rfcomm0 (with root priviledge). The first data is
successfully read. The second and the third too. But the fourth time
that I access /dev/rfcomm0, I get some odd caracteres: A

I tried to access to this interface using minicom, no problem, I can
read easily these data. I changed the computer that was under test, no
change. I changed every physical devices by other, no change.

That's why, I think I have a problem with my script.

Here is the error:

Traceback (most recent call last):
4107A6A
  File "./PowerSpy.py", line 64, in <module>
    powerspy = PowerSpy("/dev/rfcomm0")
  File "./PowerSpy.py", line 33, in __init__
    u = (struct.unpack('<f', Ucalib.decode('hex'))[0]) 	# Unpack in
LittleIndian + float (see IEEE 32-bit float representation)
  File "/usr/lib/python2.7/encodings/hex_codec.py", line 42, in
hex_decode
    output = binascii.a2b_hex(input)
TypeError: Odd-length string

The python file is in the attachement.

I am using Ubuntu 11.04 with Python 2.7.1+.

Do you have some clues to help me resolving this problem ?

Thanks,

Reg <<orange_logo.gif>> ards,
-- 

Rémi Druilhe
RD-MAPS-GRE
OLNC/MAPS/SHINE/MADE
Phone: +33 (0)4 76 76 24 27
E-mail : remi.druilhe@orange-ftgroup.com
Orange Labs Grenoble - 28 chemin du Vieux Chêne - BP98 38243 Meylan
Cedex  - France

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Odd caracteres <remi.druilhe@orange-ftgroup.com> - 2011-07-13 16:19 +0200

csiph-web