TheWeirdDev/PacktPub-Video-Downloader

Errno 22 invalid argument exception.

Closed this issue · 0 comments

If the file name contains special characters that do not allow file creation like ':' it throws , Errno 22 invalid argument error .
it fix error.
c.setopt(c.MAX_RECV_SPEED_LARGE, rate_limit)
_filename=re.sub(':','', filename)
if os.path.exists(_filename):

        file_id = open(_filename, "ab")
        c.setopt(c.RESUME_FROM, os.path.getsize(_filename))
    else:
        file_id = open(_filename, "wb")