dgorissen / coursera-dl

A script for downloading course material (video's, pdfs, quizzes, etc) from coursera.org
http://dirkgorissen.com/2012/09/07/coursera-dl-a-coursera-download-script/
GNU General Public License v3.0
1.73k stars 299 forks source link

Fail to download #114

Closed kctong529 closed 10 years ago

kctong529 commented 10 years ago

This is the case for Mac OSX 10.9.

The first issue is on .netrc file, where ~/.netrc simply cannot be located. For this input:

$ coursera-dl -d /my/coursera/courses/ coursename

Coursera-dl v1.5.1 (html.parser)
Traceback (most recent call last):
  File "/usr/local/bin/coursera-dl", line 9, in <module>
    load_entry_point('coursera-dl==1.5.1', 'console_scripts', 'coursera-dl')()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/courseradownloader/courseradownloader.py", line 538, in main
    raise Exception("No username passed and no .netrc credentials found, unable to login")
Exception: No username passed and no .netrc credentials found, unable to login

The second issue is failure even if both the username and password are given. For this input:

coursera-dl -u myusername -p mypassword -d /my/coursera/courses/ coursename

Coursera-dl v1.5.1 (html.parser)
Logging in as 'kctong529@gmail.com'...

Course 1 of 1
* Collecting downloadable content from https://class.coursera.org/coursename/lecture/index
* Got all downloadable content for coursename
Traceback (most recent call last):
  File "/usr/local/bin/coursera-dl", line 9, in <module>
    load_entry_point('coursera-dl==1.5.1', 'console_scripts', 'coursera-dl')()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/courseradownloader/courseradownloader.py", line 578, in main
    d.download_course(cn,dest_dir=args.dest_dir,reverse_sections=args.reverse,gzip_courses = args.gzip_courses)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/courseradownloader/courseradownloader.py", line 385, in download_course
    os.makedirs(course_dir)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/my'

As far as I concern, there was not such problem(s) in previous versions (which has been months ago). It's probably a problem in OSX 10.9, or the update in Python 2.7, or coursera-dl itself

dgorissen commented 10 years ago

For the first error ensure the netrc file has the correct permissions (only readable by you). If it still does not work enable printing of the exception on line 513 and report back.

The second issue seems simply a permission problem, are you sure your user has write permission to /me ?

QuixoticGitHub commented 9 years ago

I solved the problem by chmod'ing the .netrc file 600

command: chmod 600 .netrc

wunderkid commented 9 years ago

Thanks QuixoticGitHub! Changing the permissions worked.

kunal394 commented 9 years ago

What about the other error where /my is being denied of the permissions to download?