sanjacob / BlackboardSync

Download your Blackboard Learn content automatically
https://bbsync.app
GNU General Public License v2.0
34 stars 11 forks source link

[Bug Report]: "Is a directory" error #384

Closed ColeAnthonyCapilongo5735 closed 2 months ago

ColeAnthonyCapilongo5735 commented 2 months ago

BlackboardSync Version

0.17.0

BlackboardSync Release

pipx

Python Version

3.12.6

Operating System and Version

Linux

University Name

Humber Polytechnic

Problem Description

After what seems to be the end of the sync (Shutting down download workers), I get an error that results in files not being downloaded, and instead some sort of shell HTML file instead.

Log File Contents

Exception in thread Thread-2 (_sync_task):
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/sync.py", line 177, in _sync_task
    start_time = self.download()
                 ^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/sync.py", line 153, in download
    start_time = self._download.download()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/download.py", line 109, in download
    self.executor.raise_exceptions()
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/executor.py", line 44, in raise_exceptions
    error = future.result()
            ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/base.py", line 27, in _write
    with path.open("wb") as f:
         ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 1013, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '/home/<user>/Documents/Humber/bbsync/2024/<my course>/Learning Materials/labs/Lab 02_Examples_pluginShell.c A shell that dynamically loads functions/pluginShell.c A shell that dynamically loads functions'
ColeAnthonyCapilongo5735 commented 2 months ago

The content looks like this on Blackboard:

image

I assume the issue here is related to the title of the content having slashes. However not all content like that fails to download.

sanjacob commented 2 months ago

Thanks for your report. I'll look into it.

sanjacob commented 2 months ago

Can you show me how the file structure looks for this content?

ColeAnthonyCapilongo5735 commented 2 months ago

The folder path is <sync folder>/2024/<course>/Learning Materials/labs/Lab 02_Examples_pluginShell.c A shell that dynamically loads functions/pluginShell.c A shell that dynamically loads functions/. Within that folder there is only one file, called pluginShell.html.

sanjacob commented 2 months ago

A fix is coming

sanjacob commented 2 months ago

Hi there, can you try out 0.17.1-rc.1? It's available in the releases section or even on pypi. You may need to delete your configuration file (~/.config/blackboard_sync) and your previous downloads

Just let me know if this content is downloaded correctly, and if you have any further download exceptions.

ColeAnthonyCapilongo5735 commented 2 months ago

Definitely downloaded more content, but I did get this error, maybe unrelated:

Exception in thread Thread-2 (_sync_task):
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/sync.py", line 177, in _sync_task
    start_time = self.download()
                 ^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/sync.py", line 153, in download
    start_time = self._download.download()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/download.py", line 104, in download
    Course(course, job).write(self.download_location, self.executor)
    ^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/course.py", line 33, in __init__
    self.children.append(Content(content, api_path, job))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/content.py", line 44, in __init__
    self.handler = Handler(content, api_path, job)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/folder.py", line 22, in __init__
    self.children.append(content.Content(child, child_path, job))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/content.py", line 44, in __init__
    self.handler = Handler(content, api_path, job)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/folder.py", line 22, in __init__
    self.children.append(content.Content(child, child_path, job))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/content.py", line 44, in __init__
    self.handler = Handler(content, api_path, job)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/document.py", line 30, in __init__
    Attachment(attachment, api_path, job)
  File "/home/<user>/.local/pipx/venvs/blackboardsync/lib/python3.12/site-packages/blackboard_sync/content/attachment.py", line 30, in __init__
    self.filename = filename + real_ext
                    ~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

This is without deleting config or previous downloads.

ColeAnthonyCapilongo5735 commented 1 month ago

@sanjacob ok I'm still getting "is a directory" errors with 0.17.1 unfortunately

sanjacob commented 1 month ago

@ColeAnthonyCapilongo5735 you need to delete all your downloads and start from scratch. Delete your config file too.

sanjacob commented 1 month ago

Were you able to fix it?