• @felciano There appear to be 2 issues.

    Dropbox version 11.7.0 crashes when using the appex module. The keychain module does not work with the appex module.

    You will need to use Dropbox 6.4.0 and you will need to store your refresh_token somewhere else besides keychain.

    You can modify dropboxlogin like this:

    #refresh_token = keychain.get_password('dropbox', 'refresh_token') refresh_token = "your_refresh_token"

    You can then remove the dropbox folders from site-packages-3 or try this script which removes site-packages-3 from sys.path when running from a share sheet and temporarily reverts back to dropbox 6.4.0.

    import sys import appex import console print('file', appex.get_file_path()) def test(): print(sys.path[1]) if appex.is_running_extension(): # if share sheet sys.path.remove(sys.path[1]) # remove site-packages-3 from sys.path import dropbox print('dropbox version', str(dropbox.__version__)) import dropboxlogin dropbox_client = dropboxlogin.get_client() print('Getting account info...') account_info = dropbox_client.users_get_current_account() print('linked account:', account_info) test()

    If you are just trying to upload a file from a share sheet, this script does not use the dropbox module:

    import sys, os, json, shutil import appex import console import keychain import requests from requests.auth import HTTPBasicAuth app_key = "your_app_key" app_secret = "your_app_secret" refresh_token = "your_refresh_token" def dropbox_token(refresh_token): data = {'refresh_token': refresh_token, 'grant_type': 'refresh_token'} try: r = requests.post('https://api.dropbox.com/oauth2/token', data=data, auth = HTTPBasicAuth(app_key, app_secret)) result = r.json() except: print(str(sys.exc_info())) return { 'refresh_token': None, 'access_token': None, 'error': {'.tag': str(sys.exc_info())} } #print('dbx:', result) return result def upload_file(source_filename, path): with open(source_filename, 'rb') as f: data = f.read() parms = {} parms['path'] = path parms['mode'] = 'overwrite' print (json.dumps(parms)) headers = {'Authorization': 'Bearer %s' % (access_token,),'Dropbox-API-Arg': json.dumps(parms),'Content-Type': 'application/octet-stream' } url = 'https://content.dropboxapi.com/2/files/upload' try: r = requests.post(url, stream=True, headers=headers, data=data) except: print("Exception requests: %s" % str(sys.exc_info())) result = r.json() return result local_path = os.path.expanduser('~/Documents/tmp') access_token = dropbox_token(refresh_token)['access_token'] files = appex.get_file_paths() if files != None and files != []: for i in range(len(files)): print('Input path: %s' % files[i]) basename = os.path.basename(files[i]) filename=os.path.join(local_path, basename) shutil.copy(files[i], filename) upload_file(basename, '/remote/dropbox/path/' + basename)
  • Hm. You may have sorted this by now, but it sounds like you've got an old version of that workflow? I just ran my regular back up with this one: and all seems well...

  • I know I’m way late, but try either the os or the pathlib module to create a symlink, this makes it so you can edit files in a local directory but still have them sync with the files app.

  • The Dropbox SDK will only manage files when connected, correct? So just to clarify, there is no workflow or other offline equivalent to either swiping left on a file to delete, or using the in-editor feature to rename a file.?

  • Google Drive see here

  • The Cloud Jump game pulls sounds off the internet... https://github.com/Pythonista-Tools/Pythonista-Tools/blob/master/Games.md

  • @ccc said:

    Pythonista is based on CPython 2.7.5 but the current CPython is 2.7.11. It you go back and read the URLs that you provided above, you will see that urllib3 warns you if you are doing certain things with CPython versions prior to 2.7.9.

    Thank you for the version numbers -- that explains a lot. I reported this since these exceptions were not popping up in Pythonista 2.0 but started with 2.1. I'm upgrading code to Dropbox v2, but will just disable these warnings in the current v1 code.

  • @KainokiKaede166 Thanks.

    I suppose at the 135th line of your DropboxSyncv2.py

    wrong: dropboxlogin3v2
    correct: dropboxloginv2

    And, I can't delete a folder from my Dropbox, that has been deleted from Pythonista. Files in the folder can be deleted, but the folder itself can't.

    Sorry about my poor English.

  • @SimCityWok Since you have your access token you should be in good shape, especially with Pythonista 2.1.

    Take a look at Dropbox API Explorer in the Dropbox developer's area. It allows you to play and access your dropbox and generate code with just your token in hand.

    Good luck -- I hope you can get in again.

  • @JonB , I searched for conditional decorators. So I found some stuff on stackflow. Not exactly what they did, but I did this and it seems to work.

    _USE_ASYNC = False def cond_decorator(func): from threading import Thread from functools import wraps @wraps(func) def async_func(*args, **kwargs): func_hl = Thread(target = func, args = args, kwargs = kwargs) func_hl.start() return func_hl if _USE_ASYNC: return async_func else: return ui.in_background(func)

    Just so the DropboxFilePicker can work either way.

  • Or see Save Attachment

Internal error.

Oops! Looks like something went wrong!