通过python蓝牙从Android获取文件

时间:2018-12-20 00:22:22

标签: python-2.7 compiler-errors bluetooth obex

我正在编写应用程序,需要将文本文件从手机发送到我的PC。使用PyBluez,PyOBEX,Python 2.7.15和Windows10 64位,LG K10LTE。试图运行这篇文章中的代码: Convert and save string to binary file in Python 但是出现了错误:

 a, b = client.get("here.txt")
  File "C:\Python27\lib\site-packages\PyOBEX\client.py", line 312, in get
    for response in self._get(name, header_list):
  File "C:\Python27\lib\site-packages\PyOBEX\client.py", line 342, in _get
    max_length = self.remote_info.max_packet_length
AttributeError: BrowserClient instance has no attribute 'remote_info'

当我尝试这个小变化时:

from bluetooth import *
from PyOBEX.client import Client
client = Client(host, port)
client.connect()
b = client.get("here.txt")
print b

b返回:

<PyOBEX.responses.UnknownResponse instance at 0x000000000351FE08>

有人可以帮我解释一下为什么这些代码不起作用以及如何解决吗?还是告诉我其他方法如何通过蓝牙从手机接收文本文件?

0 个答案:

没有答案