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

Error charmap codec #40

Closed Andre-pwn closed 1 year ago

Andre-pwn commented 1 year ago

Downloading course file: INE Cyber Security Pass - User Guide.pdf: 100%|██████████| 1.00/1.00 [00:41<00:00, 42.0s/file] 33%|████████████████████████ | 1.00/3.00 [00:50<01:40, 50.4s/videofile] Downloading: WindowsExploitDevelopment: 0%| | 0.00/1.00 [00:50<?, ?course/s] Traceback (most recent call last): File "C:\Users\Win10\INE-courses-downloader\Ine.py", line 728, in downloader(course) File "C:\Users\Win10\INE-courses-downloader\Ine.py", line 570, in downloader download_slides(k["uuid"], slide_index) File "C:\Users\Win10\INE-courses-downloader\Ine.py", line 408, in download_slides fp.write(out.text) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\uf0e0' in position 1455: character maps to <

ghost commented 1 year ago

i think its a python config error.

need to set the default encode method to utf-8 in the config

export PYTHONIOENCODING=utf8

check out this thread: https://stackoverflow.com/questions/55727674/cant-convert-byte-literal-from-request-to-unicode-in-python

Andre-pwn commented 1 year ago

I tried with: set PYTHONIOENCODING=utf8 on Windows but doesn't work

chcp 65001 also doesn't work

Andre-pwn commented 1 year ago

@dlmart1972 I guess fixed adding encoding="utf-8" to line 408

Lomar5115 commented 1 year ago

@Andre-pwn Did the Script Work With you with no errors ?

Can you share your code script code kindly please .!

ghost commented 1 year ago

I've found this error can be related to bad headers.

try the request with no headers= in the request