Python2.7.6发布错误

2024-05-29 10:46:41 发布

您现在位置:Python中文网/ 问答频道 /正文

嗨,我用python2.7.6编写了这些代码 但不会正确执行,总是给我错误。。。 请帮帮我

if __name__ == '__main__':
    channel=None
    devices = finddevices()
    for d in devices:
        ser=findservices(d[0])
        for s in ser:
            print s
            if 'OBEX Object Push' in s[2]:
                channel=s[1]
        obex.sendfile(d[0], channel, '/home/mobile.jar')

然后离开:

('00:E3:B2:0C:2E:2B', 2, 'Headset Gateway')
('00:E3:B2:0C:2E:2B', 3, 'Handsfree Gateway')
('00:E3:B2:0C:2E:2B', 4, 'Sim Access Server')
('00:E3:B2:0C:2E:2B', 23, 'AV Remote Control Target')
('00:E3:B2:0C:2E:2B', 25, 'Advanced Audio')
('00:E3:B2:0C:2E:2B', 15, 'Android Network Access Point')
('00:E3:B2:0C:2E:2B', 15, 'Android Network User')
('00:E3:B2:0C:2E:2B', 19, 'OBEX Phonebook Access Server')
('00:E3:B2:0C:2E:2B', 12, 'OBEX Object Push')
Traceback (most recent call last):
  File "/home/abbas/workspace/Bluetooth Module/package/test.py", line 21, in <module>
    obex.sendfile(d[0], channel, '/home/abbas/mobile.jar')
  File "/usr/lib/pymodules/python2.7/lightblue/_obex.py", line 234, in sendfile
    raise TypeError("channel must be int, was %s" % type(channel))
TypeError: channel must be int, was <type 'NoneType'>

为什么我的频道没有? 为什么我的条件不是真的?你知道吗


Tags: inhomeforifobjectaccesschannelb2

热门问题