Jayapraveen / INE-courses-downloader

Python Script to download coures from INE.com website for personal and educational use
GNU General Public License v3.0
37 stars 19 forks source link

The directory name is invalid: #19

Open abdikanipd opened 3 years ago

abdikanipd commented 3 years ago

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.

telus-beep commented 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.

Kaatne-Wala-Kutta commented 3 years ago

I can fix it but I need a subscription. If anyone of you are ready to donate for 2-3 days. Reply back :)

m-diawara commented 3 years ago

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
abdikanipd commented 3 years ago

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

m-diawara commented 3 years ago

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.

abdikanipd commented 2 years ago

Still there is an error UnboundLocalError: local variable 'folder_name' referenced before assignment

CoolRoot commented 2 years ago

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.

telus-beep commented 2 years ago

subfolder_name = re.sub("[^0-9a-zA-Z.\s]+", "", subfolder_name)

same error

telus-beep commented 2 years ago

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

Aval0n1 commented 1 year ago

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('"', '')