r0oth3x49 / acloud-dl

A cross-platform python based utility to download courses from acloud.guru for personal offline use.
MIT License
351 stars 142 forks source link

Downloading Error on a course #114

Closed khamid1612 closed 1 year ago

khamid1612 commented 1 year ago

Traceback (most recent call last): File "c:\Users\kamzy\Downloads\acloud-dl-master\acloud-dl-master\acloud-dl.py", line 446, in main() File "c:\Users\kamzy\Downloads\acloud-dl-master\acloud-dl-master\acloud-dl.py", line 434, in main cloud_guru.course_download(path=options.output, quality=options.quality, File "c:\Users\kamzy\Downloads\acloud-dl-master\acloud-dl-master\acloud-dl.py", line 333, in course_download self.download_lectures_only(lecture_best=lecture_best, lecture_title=lecture_title, File "c:\Users\kamzy\Downloads\acloud-dl-master\acloud-dl-master\acloud-dl.py", line 215, in download_lectures_only self.download_assets(lecture_assets=lecture_assets, filepath=filepath) File "c:\Users\kamzy\Downloads\acloud-dl-master\acloud-dl-master\acloud-dl.py", line 156, in download_assets assets.download(filepath=filepath, quiet=True, callback=self.show_progress) File "c:\Users\kamzy\Downloads\acloud-dl-master\acloud-dl-master\acloud_shared.py", line 857, in download return self._write_external_links(filepath) File "c:\Users\kamzy\Downloads\acloud-dl-master\acloud-dl-master\acloud_shared.py", line 773, in _write_externallinks with open("{}".format(filename), "a", encoding="utf-8") as f: OSError: [Errno 22] Invalid argument: '\\?\\\?\D:\NWO\AZ-400 Designing and Implementing Microsoft DevOps Solutions\15 Designing and Implementing a Strategy for Managing Sensitive Information in Automation\005 Authenticate apps to Azure services by using service principals and managed identities for Azure resources.txt'

khamid1612 commented 1 year ago

Windows long path is enabled

khamid1612 commented 1 year ago

it is fixed now, by doing the following: The change is in the _shared.py file:

"filename = re.sub('[^A-Za-z0-9]+', '', filepath) - Adding this part in"

def _write_external_links(self, filepath):
    retVal = {}
    filename = re.sub('[^A-Za-z0-9]+', '', filepath)
    if os.name == "nt":
        # If the absolute path to the file is too long, append the 'magic' prefix
        if len(os.path.abspath(filename)) > 255:
            filename = u"\\\\?\\%s" % (os.path.abspath(filename))