C0D3D3V / Moodle-DL

Moodle-DL downloads course content fast from Moodle (eg. lecture pdfs)
GNU General Public License v3.0
433 stars 63 forks source link

[Errno 2] No such file or directory #173

Closed AlphaJack closed 1 year ago

AlphaJack commented 1 year ago

Avoid duplicates

Describe the bug

I cannot use Moodle-dl as it always return:

The following error occurred during execution:
[Errno 2] No such file or directory

Steps to reproduce the issue

Moodle log in via SSO

Moodle-dl was then configured to download everything from a whitelist of courses, except files that require cookies.

All the runs return the following:

moodle-dl --verbose

Moodle Downloader starting...
Loading config...
Checking for changes for the configured Moodle-Account....
Downloading course information   4/  4 [Introduction to..|   757]
Start downloading changed files...

Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/moodle_dl/main.py", line 286, in run_main
    downloader = DownloadService(changed_courses, moodle, storage_path, skip_cert_verify, ignore_ytdl_errors)
  File "/usr/lib/python3.10/site-packages/moodle_dl/download_service/download_service.py", line 99, in __init__
    self.ssl_context = ssl.create_default_context(cafile=certifi.where())
  File "/usr/lib/python3.10/ssl.py", line 766, in create_default_context
    context.load_verify_locations(cafile, capath, cadata)
FileNotFoundError: [Errno 2] No such file or directory

The following error occurred during execution:
[Errno 2] No such file or directory
Sending Notification via Telegram... (Please wait)

Technical details

Expected behavior

Courses are downloaded as expected

Possible Fix

Explain what URL is not found for better debugging

Not relevant to these issue, but potential setup message improvement: my SSO token was found in the 302 response at the "location" property, but it started with moodlemobile://token=XXXXXX, not moodledownloader://token=XXXXXX as written in the guide.

C0D3D3V commented 1 year ago

Explain what URL is not found for better debugging

Its not an URL that can not be reached. Its your CA-Chain. I wonder how this is possible on a linux xD Normally that is an Windows or MacOS problem. And even there certifi should find the correct CA-Chain location. I guess that has something to do with the last PR ^^ But I will try to figure out what the problem is.

Regarding moodlemobile://token=XXXXXX Feel free to improve the text. I know about that, and did not improve the text since. I wanted to program a new, better version to get the SSO token automatically, without any user interaction. I started it offline, thats why I did not update the old SSO Process... moodlemobile can basically be something completely random moodledownloader is just an example

C0D3D3V commented 1 year ago

Quick workaround would be to use the option --skip-cert-verify

C0D3D3V commented 1 year ago

I think I will use this issue to finally remove all urllib / urllib3 code and replace it with the requests library.

AlphaJack commented 1 year ago

Thank you, in the meanwhile I also tested edu-sync which is written in Rust and supports token login

C0D3D3V commented 1 year ago

and supports token login

You can also just write the token in the moodle-dl config without using the initiator script. See also: https://github.com/C0D3D3V/Moodle-Downloader-2/wiki/Config.json

But interesting project you found there. I think I will make a list of similar projects in the Readme, so people can find them easier.

C0D3D3V commented 1 year ago

Feel free to open a new issue, if the issue persists in the new release.