0x776b7364 / toggle.sg-download

Python script to automate Toggle.sg video downloads
MIT License
26 stars 18 forks source link

LookUp Error: Unknown Encoding #23

Closed cmemil closed 8 years ago

cmemil commented 8 years ago

Hi,

Many thanks for your useful utility. I'm having problems downloading any videos. Get a message at the end saying:

LookupError: unknown encoding: cp65001

Is this a system language issue?

0x776b7364 commented 8 years ago

Sounds like a Python error message. Do you have a test URL to reproduce the issue?

In another unrelated script, I've had to do the following in the Windows command shell before executing the Python script:

c:\> chcp 65001
c:\> set PYTHONIOENCODING=utf-8

Try it and see if it fixes the error.

cmemil commented 8 years ago

Hi thanks for the suggestion. It works. Do I need to do this for everytime I open a command prompt window?

0x776b7364 commented 8 years ago

Are you facing this problem with every video, or only on certain ones? I'm not exactly sure why this occurs, and unfortunately I cannot script that within the Python script (I guess I could wrap it in a batch file...).

cmemil commented 8 years ago

Yes, with every video. I remember changing the encoding type manually when I used you-get downloader. A batch file would be nice...thanks.

0x776b7364 commented 8 years ago

You can just have something like:

@echo off
chcp 65001
set PYTHONIOENCODING=utf-8
echo Calling download_toggle_video2.py %1 ...
download_toggle_video2.py %1

You might have to use the call or start commands as a prefix to the path where you execute the Python script.

cmemil commented 8 years ago

Could you please give me an example for the call or start commands? Haven't used batch commands before.

0x776b7364 commented 8 years ago

Sure. It'll either be:

call download_toggle_video2.py %1

or:

start download_toggle_video2.py %1

There are differences between them - one will start a new environment (hence disregarding your shell settings of chcp and PYTHONIOENCODING, and the other will not. Kinda hard for me to try out since I'm not having that issue.

cmemil commented 8 years ago

Thanks...I ran the below script but it still throws up the error:

@echo off
chcp 65001
set PYTHONIOENCODING=utf-8
start download_toggle_video2.py %1
echo Calling download_toggle_video2.py %1 ...
download_toggle_video2.py %1

Replacing the start with call also yields the same result.

0x776b7364 commented 8 years ago

I'd suggest you read up a bit more on batch file programming, and how to call it with parameters (that's what %1 is for) as well as experiment between start and call..

0x776b7364 commented 8 years ago

Issue closed due to a month of no-response. If you're still having issues on this, just re-open this ticket. Thanks!