Azelphur/pyPushBullet

TypeError: __init__() got an unexpected keyword argument 'mime'

buzzbo opened this issue · 6 comments

Get the following error when trying to push file using pushbullet_cmd.py:

$ ./pushbullet_cmd.py <mykey> file <mydevice> c.jpg
Traceback (most recent call last):
  File "./pushbullet_cmd.py", line 153, in <module>
    args.func(args)
  File "./pushbullet_cmd.py", line 99, in pushFile
    file = p.pushFile(args.device, os.path.basename(args.file), "", open(args.file, 'rb'))
  File "/home/pi/python/pyPushBullet/pushbullet.py", line 171, in pushFile
    mime = magic.Magic(mime=True)
TypeError: __init__() got an unexpected keyword argument 'mime'

Hmm honestly not even sure why that was there, it's fixed now :)

Thanks...but!
Now I'm getting this when executing same command:

Traceback (most recent call last):
  File "./pushbullet_cmd.py", line 153, in <module>
    args.func(args)
  File "./pushbullet_cmd.py", line 99, in pushFile
    file = p.pushFile(args.device, os.path.basename(args.file), "", open(args.fi
  File "/home/pi/python/pyPushBullet/pushbullet.py", line 171, in pushFile
    mime = magic.Magic()
TypeError: __init__() takes exactly 2 arguments (1 given)

Seems like you have a different version of magic than I do, I've made a patch that should hopefully make it work with your version of magic. Let me know if it works for you :)

eh this is what I get now...it's quite possible that things are jacked up because I have installed pip with raspbian originally and then purged it now and reinstalled using get-pip.py. Anyhow:

Traceback (most recent call last):
  File "./pushbullet_cmd.py", line 153, in <module>
    args.func(args)
  File "./pushbullet_cmd.py", line 99, in pushFile
    file = p.pushFile(args.device, os.path.basename(args.file), "", open(args.file, 'rb'))
  File "/home/pi/python/pyPushBullet/pushbullet.py", line 180, in pushFile
    data)
  File "/home/pi/python/pyPushBullet/pushbullet.py", line 43, in _request
    r.raise_for_status()
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 831, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized

That's a HTTP 401 - Wrong API key.

Ah OK I was one character off. All is good now.