r0oth3x49 / acloud-dl

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

file name is too long and download failed - windows 11 #116

Closed ars1364 closed 10 months ago

ars1364 commented 10 months ago

windows 11 Python 3.11.6 can you help me with this error message?

Traceback (most recent call last):
  File "E:\acloud-dl-master\acloud-dl.py", line 446, in <module>
    main()
  File "E:\acloud-dl-master\acloud-dl.py", line 434, in main
    cloud_guru.course_download(path=options.output, quality=options.quality,
  File "E:\acloud-dl-master\acloud-dl.py", line 333, in course_download
    self.download_lectures_only(lecture_best=lecture_best, lecture_title=lecture_title,
  File "E:\acloud-dl-master\acloud-dl.py", line 215, in download_lectures_only
    self.download_assets(lecture_assets=lecture_assets, filepath=filepath)
  File "E:\acloud-dl-master\acloud-dl.py", line 156, in download_assets
    assets.download(filepath=filepath, quiet=True, callback=self.show_progress)
  File "E:\acloud-dl-master\acloud\_shared.py", line 857, in download
    return self._write_external_links(filepath)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\acloud-dl-master\acloud\_shared.py", line 773, in _write_external_links
    with open("{}".format(filename), "a", encoding="utf-8") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: '\\\\?\\\\\\?\\E:\\acloud-dl-master\\AWS Certified Advanced Networking - Specialty (ANS-C01)\\07 Design and Implement for Security and Compliance\\009 A simpler way to assess the network exposure of EC2 instances AWS releases new network reachability assessments in Amazon Inspector.txt'
ars1364 commented 10 months ago

my mistake, you've already handled the file length, the issue was that somehow some files came with \\?\ and i added this: not os.path.abspath(filename).startswith('\\\\?\\') and in line 771 of _shared.py to handle them.