Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is a directory .dropbox #17

Closed
idnovic opened this issue Jul 2, 2019 · 22 comments
Closed

Is a directory .dropbox #17

idnovic opened this issue Jul 2, 2019 · 22 comments

Comments

@idnovic
Copy link

idnovic commented Jul 2, 2019

Currently I can not start maestral-gui

[idnovic@id-lappy ~]1$ maestral-gui 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QSocketNotifier: Can only be used with threads started with QThread
 > Loading access token...
 [OK]
 > Loading access token...
 [OK]
 > MaestralClient is ready.
Traceback (most recent call last):
  File "/home/idnovic/.local/bin/maestral", line 11, in <module>
    load_entry_point('maestral==0.1.3.dev1', 'console_scripts', 'maestral')()
  File "/home/idnovic/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/idnovic/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/idnovic/.local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/idnovic/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/idnovic/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/console_script.py", line 31, in gui
    run()
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/gui/main.py", line 197, in run
    maestral = FirstSyncDialog.configureMaestral()  # returns None if aborted
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/gui/first_sync_dialog.py", line 281, in configureMaestral
    fsd = FirstSyncDialog(parent)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/gui/first_sync_dialog.py", line 134, in __init__
    self.mdbx = Maestral(run=False)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/main.py", line 128, in __init__
    self.client = MaestralClient()
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 284, in __init__
    with open(self.rev_file, "rb") as f:
IsADirectoryError: [Errno 21] Ist ein Verzeichnis: '.dropbox'
@samschott
Copy link
Owner

samschott commented Jul 3, 2019

This is very unusual. Did this occur between updates of Maestral? Or after any other changes?

First, it seems like Maestral is trying to take you through the setup dialog. It only does that when either the Dropbox folder has been deleted or it cannot determine when the last sync was (if either of the fields "last_sync" or "cursor" in the config file "~/.maestral/maestral.ini" are empty).

Second, it does find the item '.dropbox' in the Dropbox folder, which contains its revision index, but it seems to be a folder and not a file. Is there any chance that it may have been overwritten? Which file is it actually trying to open? You can check by running:

import os
from maestral.config.main import CONF
from maestral.client import REV_FILE
dropbox_path = CONF.get("main", "path")
rev_file = os.path..join(dropbox_path, REV_FILE)

Does rev_file point to a file or folder? And is it where you expect it to be?

If you delete the dropbox folder and restart Maestral, it will rebuild the index and download all files again. But it would be nice to find out how this happened.

@idnovic
Copy link
Author

idnovic commented Jul 3, 2019

Thank you. I will later try what you suggested.

To what happened, nothing from my perspective. I had maestral open while I hit the shutdown button but I only got a black screen because I kept pushing esc to show the shutdown log. I forced the shutdown via power button. Maybe a file got corrupted.

After the above error I did update maestral because i thought maybe the bug is fixed in a newer version. Still the same error.

@idnovic
Copy link
Author

idnovic commented Jul 6, 2019

[idnovic@id-lappy ~/Dropbox]0$ python3
Python 3.7.3 (default, May 11 2019, 00:38:04) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> from maestral.config.main import CONF
>>> from maestral.client import REV_FILE
>>> dropbox_path = CONF.get("main", "path")
>>> rev_file = os.path.join(dropbox_path, REV_FILE)
>>> 

No output

@samschott
Copy link
Owner

Really? That cannot be. At least REV_FILE is always defined. Did you print the value of rev_file with print(rev_file)? The result should be something similar to ~/username/Dropbox/.dropbox.

@samschott
Copy link
Owner

And the file should be binary file and not a folder. You will be able to see it in your Dropbox folder when you turn on "show hidden files." Maestral will never save a folder to this location. Thats what confuses me.

It may be possible that you forced your PC to shut down while the file was open and that it got corrupted. But that seems very unlikely.

@idnovic
Copy link
Author

idnovic commented Jul 6, 2019

[idnovic@id-lappy ~/Dropbox]0$ python3
Python 3.7.3 (default, May 11 2019, 00:38:04) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> from maestral.config.main import CONF
>>> from maestral.client import REV_FILE
>>> dropbox_path = CONF.get("main", "path")
>>> rev_file = os.path.join(dropbox_path, REV_FILE)
>>> print(rev_file)
.dropbox
>>> 

@idnovic
Copy link
Author

idnovic commented Jul 6, 2019

How do I force a resync without deleting the content of my dropbox folder?

@samschott
Copy link
Owner

samschott commented Jul 6, 2019

@idnovic, thanks for the info. I think I know what the problem is - and it does not have anything to do with a corrupted index file.

I believe your settings got overwritten accidentally during an update. Could you do the following, and see if it fixes the issue?

  1. Quit Maestral.
  2. Open its settings folder '~/.maestral'
  3. There should be multiple files in this folder. One of them ends with '.ini' and contains the current settings. Several others should end with '.bak' and are backup files. Their contents all should all look like this in a text editor:
[main]
path = /Users/samschott/Dropbox
excluded_folders = []
excluded_files = ['desktop.ini', 'thumbs.db', '.ds_store', 'icon\r', '.dropbox.attr', '.dropbox']
version = '2.0.0'

[account]
email = ss2151@cam.ac.uk
type = business
usage = 30.1% of 1,313,560.0GB used
usage_type = team

[app]
system_startup = True
notifications = True

[internal]
cursor = 'a long alphanumeric string'
lastsync = 'a long number'
recent_changes = 'a list of recently changed items'

I expect that those settings got overwritten with the defaults during an update, and yours will likely look like this:

[main]
path = 
excluded_folders = []
excluded_files = ['desktop.ini', 'thumbs.db', '.ds_store', 'icon\r', '.dropbox.attr', '.dropbox', '.maestral_rev_dict']

[account]
email = 
type = 
usage = 
usage_type = 

[app]
system_startup = False
notifications = True

[internal]
cursor = 
lastsync = None
recent_changes = []

Could you look through the backup files, find the last modified file that has non-empty values for the path, excluded_folders, cursor and lastsync entries and copy those entries over to 'maestral.ini'? The most recent backup file will have the most recent 'modified' date and the largest number for lastsync. It may be titled 'maestral.ini-2.1.0.bak'.

  1. Start Maestral again. It will load the correct settings (most notably, the correct Dropbox folder location) and pick up syncing where it left off. All other empty fields will be updated automatically.

This is a bug in the code which updates the settings file in-place. It seems to have accidentally reverted all settings when adding the entry recent_changes in the latest update :/

Sorry about all of this!

PS: You seem to have folder called '.dropbox' in your root directory. How did that happen?

@idnovic
Copy link
Author

idnovic commented Jul 6, 2019

[idnovic@id-lappy ~/.maestral]0$ cat ma
maestral.ini      maestral.ini.bak  
[idnovic@id-lappy ~/.maestral]0$ cat maestral.ini
[main]
path = 
excluded_folders = []
excluded_files = ['desktop.ini', 'thumbs.db', '.ds_store', 'icon\r', '.dropbox.attr', '.dropbox']
version = '2.0.0'

[account]
email = 
type = 
usage = 
usage_type = 

[app]
system_startup = False
notifications = True

[internal]
cursor = 
lastsync = None
recent_changes = []

[idnovic@id-lappy ~/.maestral]0$ cat maestral.ini.bak 
[main]
path = 
excluded_folders = []
excluded_files = ['desktop.ini', 'thumbs.db', '.ds_store', 'icon\r', '.dropbox.attr', '.dropbox']
version = '2.0.0'

[account]
email = 
type = 
usage = 
usage_type = 

[app]
system_startup = False
notifications = True

[internal]
cursor = 
lastsync = None
recent_changes = []

PS: You seem to have folder called '.dropbox' in your root directory. How did that happen?

If it is not used by maestral then I think this is from the original dropbox which I currently do not use.
What is the right place for the folder from your perspective?

@samschott
Copy link
Owner

For Maestral, '.dropbox' should be binary file and not a folder. And it should be in your local Dropbox directory. I would guess that it is still present in your folder.

Does your post mean that the backup has empty settings as well? And there is no other backup file? What do you get from 'ls ~/.maestral'? The output should look like this:

... $ ls ~/.maestral
defaults		maestral.ini-2.0.0.bak	o2_store.txt
maestral.ini		maestral.ini.bak

Here, defaults is a folder with default settings, maestral.ini-2.0.0.bak and maestral.ini.bak are configuration backups, maestral.ini is the currently used configuration and o2_store.txt is your personal (secret) authentication token.

@samschott
Copy link
Owner

If you cannot recover the last sync status from a backup file, I am afraid you will have to re-download your dropbox completely. Before you do so, delete the stray '.dropbox' item in your root directory. Otherwise, the current version of Maestral will crash on startup. I have fixed this behavior now.

I will look into what went wrong with the config files. The code here isn't actually my own but copied from the Spyder IDE. So it may take me some for me to figure out.

@idnovic
Copy link
Author

idnovic commented Jul 7, 2019

yes the above maestral.ini files are the only once. I did view the folder with ls -a and the other files are as you expected.

.dropbox is in my case a folder and not a file. If maestral did not create it then dropbox did. In this case you should move maestral's file to an other location. I will post the content of my .dropbox folder below.

@samschott
Copy link
Owner

Neither Maestral nor Dropbox itself should create anything in the root folder! In any case, commit 8b64629 should deal with this correctly and will no longer be bothered by the stray folder.

@idnovic
Copy link
Author

idnovic commented Jul 7, 2019

[idnovic@id-lappy ~/.dropbox]0$ ls -a
.               dropbox.pid  iface_socket  instance_db      unlink.db
..              events       info.json     logs
command_socket  host.db      instance1     machine_storage

@idnovic
Copy link
Author

idnovic commented Jul 7, 2019

[idnovic@id-lappy ~]0$ maestral-gui 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QSocketNotifier: Can only be used with threads started with QThread
 > Loading access token...
 [OK]
 > Loading access token...
 [OK]
 > MaestralClient is ready.
Maestral index could not be found. Rebuild if necessary.
Up to date
Syncing paused
Indexing...
Indexing 235...
Indexing 446...
Indexing 475...
Indexing 542...
Syncing...
Downloading 1/444...
Exception in thread MaestralFolderDownloader:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/main.py", line 55, in folder_download_worker
    client.get_remote_dropbox(dbx_path)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 796, in get_remote_dropbox
    success = self.apply_remote_changes(result, save_cursor)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 960, in apply_remote_changes
    success += [f.result()]
  File "/usr/lib64/python3.7/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib64/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/lib64/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 1130, in _create_local_entry
    self._save_to_history(entry.path_display)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 1194, in _save_to_history
    recent_changes.append(dbx_path)
AttributeError: 'NoneType' object has no attribute 'append'

QImage::pixel: coordinate (0,0) out of range
Traceback (most recent call last):
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/gui/main.py", line 224, in update_recent_files
    for dbx_path in reversed(CONF.get("internal", "recent_changes")):
TypeError: 'NoneType' object is not reversible
/home/idnovic/.local/bin/maestral-gui: Zeile 6:  3744 Abgebrochen             (Speicherabzug geschrieben) maestral gui

This is with the newest update

@samschott
Copy link
Owner

Oups. Fixed in the last commit. Very sorry, the default setting for recent_changes should have been an empty list and not None...

@samschott
Copy link
Owner

[idnovic@id-lappy ~/.dropbox]0$ ls -a
. dropbox.pid iface_socket instance_db unlink.db
.. events info.json logs
command_socket host.db instance1 machine_storage

Ah, this does look like the original Dropbox client settings. You should not delete this! I misunderstood and thought the folder was located in your root directory instead of your home directory. Thats why I was so confused.

@idnovic
Copy link
Author

idnovic commented Jul 7, 2019

[idnovic@id-lappy ~]0$ maestral-gui 
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QSocketNotifier: Can only be used with threads started with QThread
 > Loading access token...
 [OK]
 > Loading access token...
 [OK]
 > MaestralClient is ready.
Up to date
Syncing paused
Indexing...
Indexing 235...
Indexing 329...
Indexing 335...
Syncing...
Downloading 1/444...
Downloading 2/444...
Exception in thread MaestralFolderDownloader:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/main.py", line 55, in folder_download_worker
    client.get_remote_dropbox(dbx_path)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 796, in get_remote_dropbox
    success = self.apply_remote_changes(result, save_cursor)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 960, in apply_remote_changes
    success += [f.result()]
  File "/usr/lib64/python3.7/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib64/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/lib64/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 1130, in _create_local_entry
    self._save_to_history(entry.path_display)
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/client.py", line 1194, in _save_to_history
    recent_changes.append(dbx_path)
AttributeError: 'NoneType' object has no attribute 'append'

QImage::pixel: coordinate (0,0) out of range
Traceback (most recent call last):
  File "/home/idnovic/.local/lib/python3.7/site-packages/maestral/gui/main.py", line 224, in update_recent_files
    for dbx_path in reversed(CONF.get("internal", "recent_changes")):
TypeError: 'NoneType' object is not reversible
/home/idnovic/.local/bin/maestral-gui: Zeile 6:  3458 Abgebrochen             (Speicherabzug geschrieben) maestral gui

I have this error with the latest version. Still the same?

@samschott
Copy link
Owner

samschott commented Jul 7, 2019

Oups. Fixed in the last commit. Very sorry, the default setting for recent_changes should have been an empty list and not None...

You may need to edit the config file manually as well and replace recent_changes: None with recent_changes: []. It seems like, at least this time, old settings have not been overwritten.

@idnovic
Copy link
Author

idnovic commented Jul 7, 2019

Yes it works again!

@idnovic idnovic closed this as completed Jul 7, 2019
@samschott
Copy link
Owner

Great :) I will be more careful with testing changes before pushing in the future.

@idnovic
Copy link
Author

idnovic commented Jul 7, 2019

no problem and thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants