bernd-wechner / Degoo

CLI tool(s) for working with Degoo cloud storage
Other
143 stars 41 forks source link

Stack-trace while listing subfolder items #36

Closed frleong closed 6 months ago

frleong commented 2 years ago

Hello, I am using the Ultimate plan of Degoo. I overcame the issue of 429, by modifying the login part using cloudscrapper, but now I face another issue whenever I try to list items in a subfolder. I get the following stacktrace:

Traceback (most recent call last): File "./degoo_ll", line 328, in sys.exit(main()) File "./degoo_ll", line 116, in main degoo.ls(args.folder, args.long, args.human, args.recursive) File "/mnt/devel/Degoo/degoo/util.py", line 1210, in ls items = get_children(directory) File "/mnt/devel/Degoo/degoo/util.py", line 604, in get_children __CACHE_CONTENTS__[dir_id] = api.getFileChildren3(dir_id) File "/mnt/devel/Degoo/degoo/API.py", line 625, in getFileChildren3 prefix = self.devices[i['DeviceID']] + os.sep + "Recycle Bin" if binned else self.devices[i['DeviceID']] KeyError: 27437396 degoo_ll: 27437396

I have no problems issuing the same command on the root folder, but all other folders return the same error.

What can I do to troubleshoot the issue? Thanks!

Francisco

bernd-wechner commented 2 years ago

I'd break on that line and inspect the variables. Something seems awry indeed.

My first tip is, when filing a traceback is use code quoting as in:

Traceback (most recent call last):
File "./degoo_ll", line 328, in
sys.exit(main())
File "./degoo_ll", line 116, in main
degoo.ls(args.folder, args.long, args.human, args.recursive)
File "/mnt/devel/Degoo/degoo/util.py", line 1210, in ls
items = get_children(directory)
File "/mnt/devel/Degoo/degoo/util.py", line 604, in get_children
CACHE_CONTENTS[dir_id] = api.getFileChildren3(dir_id)
File "/mnt/devel/Degoo/degoo/API.py", line 625, in getFileChildren3
prefix = self.devices[i['DeviceID']] + os.sep + "Recycle Bin" if binned else self.devices[i['DeviceID']]
KeyError: 27437396
degoo_ll: 27437396

which is easier to read. To use that it's just three backquotes as a delimeter each side. Small tutorial here:

http://andybrandt531.com/2015/03/markdown-for-bloggers-part-5-quoting-textcode/

But as importantly when it points to a line of code a link to the code can speed things up and help see if you're using the latest push:

https://github.com/bernd-wechner/Degoo/blob/2eed880b97f83679d9280a3f773fb72b614e35da/degoo/API.py#L623

When I look at that the context becomes clear:

# Fix the FilePath from Degoo incompleteness to a complete path.
if cat in ["Device", "Recycle Bin"]:
    if cat == "Device":
        i["FilePath"] = f"{os.sep}{i['Name']}"
    elif cat == "Recycle Bin":
        i["FilePath"] = f"{os.sep}{self.devices[i['DeviceID']]}{os.sep}Recycle Bin"
else:
    # FilePath includes neither the Device name nor Recylce Bin alas. We
    # patch those in here to provide a FilePath that is complete and
    # compariable with the web interface UX.
    binned = i["IsInRecycleBin"]
    prefix = self.devices[i['DeviceID']] + os.sep + "Recycle Bin" if binned else self.devices[i['DeviceID']]
    i["FilePath"] = f"{os.sep}{prefix}{i['FilePath'].replace('/',os.sep)}"

and what I'm suspecting is i['DeviceID'] is 27437396 and that self.devices lacks such an entry. Why will need more thinking. I'll look later and see if I can think of a reason. Have to run now, but wanted to leave you with some clues.

frleong commented 2 years ago

Thanks for your reply. I shall follow the etiquette to make the trace easier to read. Meanwhile, I'll try to learn how to decipher the devices entry

bernd-wechner commented 2 years ago

Any progress on this?

frleong commented 2 years ago

Sorry, I couldn't decipher the output and I gave up finally. I still rely on manual upload through the stupid and slow official web interface.

bernd-wechner commented 6 months ago

This was most likely fixed by:

https://github.com/bernd-wechner/Degoo/commit/bc92782790771faacd506e4d110622633bc120b6