python - python 和 Sublime text 2 的奇怪错误

标签 python bluetooth sublimetext2

我正在尝试用Python编写代码来从蓝牙读取数据。这是我到目前为止的代码:

import serial

arduinoData = serial.Serial('com7', 9600)

while True:
  while(arduinoData.inWaiting() == 0): # Si no hay datos, se espera
    print "There is no data"
    pass


  arduinoString = arduinoData.readline()
  print "This is the Data: "
  print arduinoString

在我的第一次尝试中,我遇到了这个错误:

enter image description here

所以我搜索了这个错误,发现了这个: UTF-8 and SublimeText

按照答案所说的进行操作后,这次我得到:

enter image description here

这是什么意思?这是解码错误还是其他类型的错误?

希望你能帮助我。

最佳答案

[SOH] 是 Sublime 使用的 ASCII 0x01 的文本表示,即 Start of Heading控制字符。您的代码没有任何问题 - 这只是通过连接发送的内容。

关于python - python 和 Sublime text 2 的奇怪错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36501231/

相关文章:

python - 如何从列表列表中提取所有唯一组合

editor - Sublime Text : open containing folder

Java 蓝牙检测失败

android - 未调用蓝牙 GATT 断开 onConnectionStateChange

python - input() 函数对我不起作用(Python 3.3)

sublimetext2 - Sublime Text 2 在带有文件扩展名的文件夹中查找

python - shutil.move(scr, dst) 得到 IOError : [Errno 13] Permission denied and 3 more errors

python - Django 静态文件在本地加载但不在开发服务器上加载

python - 字符串中的日期时间对象, float 中的秒数

android - Android 中的蓝牙音频控件