r0oth3x49 / lynda-dl

A cross-platform python based utility to download courses from lynda.com for personal offline use.
MIT License
295 stars 95 forks source link

ValueError: binary mode doesn't take an encoding argument #40

Closed abdullahicyc closed 6 years ago

abdullahicyc commented 6 years ago

I'm using Python 3.6.4 on Windows Machine. I got this error after the download started.

Traceback (most recent call last):

File "lynda-dl.py", line 349, in main() File "lynda-dl.py", line 345, in main lynda.course_download(path=options.output, quality=options.quality) File "lynda-dl.py", line 172, in course_download course.course_description(filepath=course_path) File "D:\lynda-dl\lynda_shared.py", line 145, in course_description return self._write_to_file(data, description_path) File "D:\lynda-dl\lynda_shared.py", line 115, in _write_to_file with open(filename, 'wb', encoding='utf-8') as f: ValueError: binary mode doesn't take an encoding argument

and i fixed it by removing the encoding='utf-8' like this


def _write_to_file(self, data, filename):
    if pyver == 3:
        with open(filename, 'wb') as f:
            try:
                f.write(data)
            except Exception as e:
                retVal = {'status' : 'False', 'msg' : 'Python3 Exception : {}'.format(e)}
            else:
                retVal = {'status' : 'True', 'msg' : 'download'}
        f.close()
....................................

and it works fine for me.

ghost commented 6 years ago

Works Like Charm...