joe42 / CloudFusion

Linux file system (FUSE) to access Dropbox, Sugarsync, Amazon S3, Google Storage, Google Drive or WebDAV servers.
http://joe42.github.com/CloudFusion/
288 stars 35 forks source link

Cannot connect to dropbox #21

Open adatamonk opened 9 years ago

adatamonk commented 9 years ago

HI there,

I am seeing this error:

Process Process-1: Traceback (most recent call last): File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run self._target(_self._args, *_self._kwargs) File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.13-py2.7.egg/cloudfusion/main.py", line 53, in set_configuration shutil.copyfile(config_file, virtual_configuration_file) File "/usr/lib/python2.7/shutil.py", line 84, in copyfile copyfileobj(fsrc, fdst) IOError: [Errno 14] Bad address

joe42 commented 9 years ago

@afinite , Please start cloudfusion with the foreground option and post the complete error message:

cloudfusion --config ~/db.ini mnt foreground

It might be an issue with your configuration file. You can post your configuration file as a gist so that I can take a look at it: https://gist.github.com/ (Please replace your username and password)

maxstainer commented 9 years ago

Hi Joe,

This is the complete error report: I think is not a .ini file issue because nothing was changed except user/pass and consumer key/secret. System is Debian 7 64bit

cloudfusion --config ~/Dropbox.ini mnt foreground Logging handler DBHandler was initialized before calling cloudfusion.mylogging.db_logging_thread.start(). Nothing will be logged. Exception in write: Incorrect padding Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/fuse.py", line 301, in wrapper return func(_args, *_kwargs) or 0 File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/fuse.py", line 377, in write return self.operations('write', path, data, offset, fh) File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/fuse.py", line 512, in call return getattr(self, op)(_args) File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/pyfusebox/transparent_configurable_pyfusebox.py", line 125, in write return super( TransparentConfigurablePyFuseBox, self ).write(path, buf, offset, fh) File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/pyfusebox/configurable_pyfusebox.py", line 177, in write written_bytes = self.virtual_file.write(buf, offset) File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/pyfusebox/virtualconfigfile.py", line 50, in write self._initialize_store() File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/pyfusebox/virtualconfigfile.py", line 153, in _initialize_store store = self.get_new_store(service, config) #catch error? File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/pyfusebox/virtualconfigfile.py", line 200, in get_new_store raise e TypeError: Incorrect padding Process Process-1: Traceback (most recent call last): File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run self._target(_self._args, **self._kwargs) File "/usr/local/lib/python2.7/dist-packages/CloudFusion-7.5.19-py2.7.egg/cloudfusion/main.py", line 53, in set_configuration shutil.copyfile(config_file, virtual_configuration_file) File "/usr/lib/python2.7/shutil.py", line 84, in copyfile copyfileobj(fsrc, fdst)

joe42 commented 9 years ago

The exception "TypeError: Incorrect padding" suggests that you accidentially modified the configuration file, or more precisely the values of consumer_key or consumer_secret. This might not be visible for you, as you might have added a space character, or maybe your text editor changed a line ending character. Try to start from a new copy of the file, and only insert your credentials. Since you say you did not change the file otherwise; Which editor did you use? Maybe try another one. Though the thesis with the editor seems a bit far fetched, I don't know what else could cause the issue. Also, you can copy&paste the configuration file as a gist as suggested above, so that I can take a look at it

yan12125 commented 8 years ago

I think I've found the problem - Dropbox id and secret are no longer base64 encoded. With the following patch:

$ git diff                                      
diff --git a/cloudfusion/store/dropbox/dropbox_store.py b/cloudfusion/store/dropbox/dropbox_store.py
index a03ef57..8aeaaad 100644
--- a/cloudfusion/store/dropbox/dropbox_store.py
+++ b/cloudfusion/store/dropbox/dropbox_store.py
@@ -185,7 +185,7 @@ class DropboxStore(Store):
             credentials_db = {}
         id_key = get_id_key(config)
         secret_key = get_secret_key(config)
-        self.sess = session.DropboxSession(base64.b64decode(config[id_key]), base64.b64decode(config[secret_key]), config['root'])
+        self.sess = session.DropboxSession(config[id_key], config[secret_key], config['root'])
         if key in credentials_db:
             self.sess.token = credentials_db[key]
             return self.sess

I can access Dropbox files after confirming the access in the browser and restart CloudFusion. I've encountered some "does not exist in parent directory" errors, but that's not a big problem for my current usage.

joe42 commented 8 years ago

@yan12125: Thanks, now I see the reason for the problem. Let me state this clearly: You are not supposed to change the Dropbox configuration file except for the username and password. The Readme file states: "Edit the configuration file by adding your username and a password." and thats it. I might add " and leave the configuration file untouched otherwise." and remove the misleading comment in the configuration file in later releases. Sorry for that.