C0D3D3V/Moodle-DL

NoneType has no len() - not downloading

Closed this issue · 1 comments

Description of the bug

I am enrolled in several Moodle courses and wanted to download them. I installed moodle-dl via pip and ran the unit and config.
After that I ran
.local/bin/moodle-dl --path /some/path
And for several minutes got many lines like
[298/307] Loaded course core 1077461 "Spanish I".
Then it stopped with the following error:
The following error occurred during execution:
object of type 'NoneType' has no len()
Exception: object of type 'NoneType' has no len()

In the specified directory no course content can be found , only config.json, MoodleDl.log , Cookies.txt and moodle_state.db

Steps to reproduce the issue

Running the command:
.local/bin/moodle-dl --path /some/path
The following error occurred during execution:
object of type 'NoneType' has no len()
Exception: object of type 'NoneType' has no len()

Expected behavior

I expected the course contents (PDFs, videos) be downloaded.

Possible Fix

Technical details

OS: Linux
Moodle-DL version: 2.3.2.0

ERROR {main} Traceback (most recent call last):
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/main.py", line 536, in main
choose_task(config, opts)
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/main.py", line 68, in choose_task
run_main(config, opts)
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/main.py", line 136, in run_main
raise base_err
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/main.py", line 106, in run_main
downloader = DownloadService(changed_courses, config, opts, database)
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/downloader/download_service.py", line 24, in init
self.all_tasks = self.gen_all_tasks()
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/downloader/download_service.py", line 36, in gen_all_tasks
Task(
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/downloader/task.py", line 78, in init
self.filename = PT.to_valid_name(self.file.content_filename, is_file=True)
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/utils.py", line 449, in to_valid_name
name = PathTools.truncate_filename(name, is_file, max_length)
File "/home/zorin/.local/lib/python3.8/site-packages/moodle_dl/utils.py", line 460, in truncate_filename
ext_len = len(ext)
TypeError: object of type 'NoneType' has no len()