I am confused.
I coded this code
if __name__ == '__main__':
channel=None
devices = finddevices()
print 'devices %s'%devices
for d in devices:
print d[0]
ser=findservices(addr=d[0],name=None,servicetype=OBEX)
print ser
for s in ser:
print s
if 'OBEX Object Push' in s[2]:
channel=s[1]
obex.sendfile(d[0], channel, '/home/mobile.jar')
If I write line by line in the python shell it works fine.
If I set a breakpoint and debug and with F6 key step by step execute all, it works fine.
But if I execute it normally in eclipse or terminal via python mycode.py
the value of ser
is None
.
What is wrong?
Why findservices()
wont work during the normal execution of the code?
Edit :
This is the output from service=findservices()
in the python shell (in eclipse during a normal run it is always [])
>>> services=findservices()
services [('6C:0E:0D:3A:1F:90', 2, 'Serial Port 1'), ('6C:0E:0D:3A:1F:90', 1, 'Dial-up Networking'), ('6C:0E:0D:3A:1F:90', 10, 'OBEX SyncML Client'), ('6C:0E:0D:3A:1F:90', 25, 'Music Streaming Service'), ('6C:0E:0D:3A:1F:90', 23, 'Remote Control Target Service'), ('6C:0E:0D:3A:1F:90', 23, 'Remote Control Service'), ('6C:0E:0D:3A:1F:90', 2, 'SEMC Watch Phone'), ('6C:0E:0D:3A:1F:90', 15, 'PAN Network Access Point'), ('6C:0E:0D:3A:1F:90', 15, 'PAN user'), ('6C:0E:0D:3A:1F:90', 5, 'Hands-Free Gateway'), ('6C:0E:0D:3A:1F:90', 4, 'Headset Gateway'), ('6C:0E:0D:3A:1F:90', 6, 'OBEX Object Push'), ('6C:0E:0D:3A:1F:90', 7, 'OBEX File Transfer'), ('6C:0E:0D:3A:1F:90', 8, 'OBEX IrMC Sync Server'), ('6C:0E:0D:3A:1F:90', 17, 'HID Mouse & Keyboard'), ('6C:0E:0D:3A:1F:90', 61689, 'SEMC HLA'), ('6C:0E:0D:3A:1F:90', 11, 'Phonebook Access PSE')]