title: Sending files via OBEX (lightblue/OBEXFTP)
body: <p>I'm trying desperately to send files via OBEX, using python. I have two functioning codes, the first using lightblue and the other using obexftp. We've got here two android phones, the first is a Samsung Galaxy S and the second is HTC desire HD (running CyanogenMod 7.1). I'm trying to send files to these phones from a computer running Ubuntu (both natty and lucid).</p>
  
  <p>The thing is, each code works with only one phone. And only sometimes.</p>
  
  <p>The first one is:</p>
  
  <pre><code>import lightblue
  client=lightblue.obex.OBEXClient('MACADDR',CHANNEL)
  client.connect()
  client.put({'name':'file.png'},file('file.png',"rb"))
  client.disconnect()
  </code></pre>
  
  <p>this one only works with the galaxy s.
  If I try to send files to the desire hd I get:</p>
  
  <pre><code>&lt;OBEXRespnse reason='Internal Server Error' code=0x50 (0xd0) headers={}&gt;
  </code></pre>
  
  <p>The second code is:</p>
  
  <pre><code>import obexftp
  cli=obexftp.client(obexftp.BLUETOOTH)
  channel=obexftp.browsebt('MACADDR',obexftp.PUSH)
  print channel #it is the correct channel, I've doubled checked
  cli.connect ('MACADDR',channel)
  cli.put_file("./file.png") #I also noticed you need to wait a second before this
  cli.disconnect()
  </code></pre>
  
  <p>This one only works with the desire hd (sometimes).</p>
  
  <p>All devices were paired using the bluez-simple-agent script, which is available in Ubuntu.</p>
  
  <p>I'm trying to figure out what's causing this inconsistency, unsuccessfully. I'd happy if someone here point out what am I doing wrong or show me a code that actually works.</p>