Open abdikanipd opened 3 years ago
I am in same boat cannot download any course which has ( : ) in the directory name. I think the developer is too busy, he is not looking at his repo any more.
I can fix it but I need a subscription. If anyone of you are ready to donate for 2-3 days. Reply back :)
just go to the code and add the following lines:
342. folder_name = str(folder_index) + '.' +i["name"]
343. folder_name = folder_name.replace(":", "") # <--- add this line
...
350. subfolder_name = str(subfolder_index) + '.' + j["name"]
351. subfolder_name = subfolder_name.replace(":", "") # <--- add this line
just go to the code and add the following lines:
342. folder_name = str(folder_index) + '.' +i["name"] 343. folder_name = folder_name.replace(":", "") # <--- add this line ... 350. subfolder_name = str(subfolder_index) + '.' + j["name"] 351. subfolder_name = subfolder_name.replace(":", "") # <--- add this line
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '4.Dynamic Access Lists - "Lock and Key"' I think the problem is file name not the folder_name and subfolder_name "Lock and Key" that make the Error
replace the lines I've indicated with:
folder_name = re.sub("[^0-9a-zA-Z.\s]+", "", folder_name)
...
subfolder_name = re.sub("[^0-9a-zA-Z.\s]+", "", subfolder_name)
then, go to the download_video
function and add: filename = re.sub("[^0-9a-zA-Z.\s]+", "", filename)
at the first line.
all these are quick and dirty solutions, but it is sufficient to fix your issue.
Still there is an error UnboundLocalError: local variable 'folder_name' referenced before assignment
The root cause of this issue is the Windows file-system not allowing file names with "." or ":" or any troubling special chars, if you don't want to modify the code to fix this, simply run the script from any Linux OS, or use Cygwin (with latest python installed with the requirements) on Windows and this issue should go away.
subfolder_name = re.sub("[^0-9a-zA-Z.\s]+", "", subfolder_name)
same error
The root cause of this issue is the Windows file-system not allowing file names with "." or ":" or any troubling special chars, if you don't want to modify the code to fix this, simply run the script from any Linux OS, or use Cygwin (with latest python installed with the requirements) on Windows and this issue should go away.
Linux OS gives the same error
In order to run the script properly on Windows I added the following stings:
under subfolder_name = str(subfolder_index) + '.' + j["name"] subfolder_name = subfolder_name.replace(':', '') subfolder_name = subfolder_name.replace('\t', '') subfolder_name = subfolder_name.replace('"', '')
under folder_name = str(folder_index) + '.' +i["name"] folder_name = folder_name.replace(':', '') folder_name = folder_name.replace('\t', '') folder_name = folder_name.replace('"', '')
Downloading: CiscoNetworkAccessSecurity: 0%| | 0.00/1.00 [00:00<?, ?course/s] Traceback (most recent call last): File "c:/Users/boy/INE-courses-downloader/Ine.py", line 479, in
downloader(course)
File "c:/Users/boy/INE-courses-downloader/Ine.py", line 352, in downloader
os.makedirs(subfolder_name)
File "C:\Users\boy\AppData\Local\Programs\Python\Python36-32\lib\os.py", line 220, in makedirs
mkdir(name, mode)
NotADirectoryError: [WinError 267] The directory name is invalid: '1.Access Control : Network'
I get that error I think the problem is '1. Access Control : Network' : that character not allowed as name of the folder.