Dropbox file picker needs update
Dropbox has deprecated API v1., and so this very useful script no longer works.
I do not get this error. (I have tested with various file extensions .txt, .py, .zip, .jpg etc). I use beta version of pythonista. May be this is due to different versions of request or json module. May be others could throw some light on this.
Can you try with python2 with original omz version with @bosco changes?
I do not have this "simplejson" module. Rename this module and see if that works.
I think that this is the issue. See the following url/
Hmm..I renamed the SimpleJson folder which was in sitepackages but I get the same error regardless.Funny thing is that this worked before bu now even the version I created from thte earlier posts is failing the same way. It must be somethign other than that simplejson.
Try running the following code to see if simplejson module is imported. Did you restart the pythonista after renaming sinplejson module?
import simplejson
@ihf This script appears to work with python 2 or 3. Try changing #!python3 to #python2. It shouldn't be using simplejson, since json is a core python module. I see now that the your error may be a problem with your requests package. LIne 42 which reads result = r.json coverts the result to json. Line 41 contains json.dumps(data), which converts the arguemnts to a string.
@enceladus Thanks for creating the gist.
in requests.compat:
try: import simplejson as json except (ImportError, SyntaxError): # simplejson does not support Python 3.2, it throws a SyntaxError # because of u'...' Unicode literals. import json
If simplejson is present, requests will use it. delete simplejson and fo ce quit pythonista
I am at a loss. Something obviously changed in my setup but I have no clue as to what. I deleted simplejson, emptied trash and restarted Pythonista. Then I recreatied the script using the gist and adding my access key and I get a jsondecode error Expecting value: line 1 column 1 (char 0).
If I run under Python 2.7 I get "No JSON object could be decoded'
import simplejson results in module not found so perhaps now I have a different problem.
I figured it out (sort of). I generated a new access key and now it works. Thank you all.
The new version is added to pythonista-tools. Thanks to all.
script name: Dropbox File Picker V2
Description: Script to import a file from Dropbox into Pythonista - Dropbox V2 API
This is great, thank you. While I am dreaming, it would be wonderful if someone in the future were able to make the picker, 2-way so that individual files could be uploaded to dropbox as well as downloaded as is the case now.
@ihf, I do not use Dropbox, but if you have the Dropbox client installed, is it not available when you Share... from Pythonista?
@mikael You are quite right....somehow I never noticed the Share from Pythonista only the Share to. Thanks for pointing that out.