python 2.7.6 for for for issue bug

时间:2014-05-07 14:13:10

标签: python traceback

您好我在python 2.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')

and out:

('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'>

为什么我的频道没有? 为什么我的if条件不正确?

0 个答案:

没有答案