pyload / pyload

The free and open-source Download Manager written in pure Python
https://pyload.net
Other
3.3k stars 711 forks source link

ExternalScripts: 'ascii' codec can't decode byte issue #3151

Closed m0n4 closed 6 years ago

m0n4 commented 6 years ago

Hello

I've an issue with a selfmade ExternalScripts, I'm sure it'll be obvious to you, but I can't do it alone.

14.04.2018 19:38:50 INFO Package finished: mypackage 14.04.2018 19:38:50 INFO ADDON ExtractArchive: Check package: mypackage 14.04.2018 19:38:50 INFO ADDON ExternalScripts: Executing scripts in folder all_downloads_processed... 14.04.2018 19:38:50 INFO ADDON ExtractArchive: No files found to extract 14.04.2018 19:38:50 WARNING Error calling event handler allDownloadsProcessed: <bound method ExternalScripts.all_downloads_processed of >, (), 'ascii' codec can't decode byte 0x92 in position 16: ordinal not in range(128)

the python script (functional) to run under windows

# coding: utf-8
import os, shutil
import unicodedata
path = r'C:/Users/TV/Downloads/PyLoad/'
moveto = r'//FREEBOX_SERVER/Disque dur/Vidéos/Pyload/'
files = os.listdir(path)
files.sort()
for f in files:
    src = path+f
    dst = moveto+f
    shutil.move(src,dst)

thanks in advance

GammaC0de commented 6 years ago

Just a hunch, try changing these lines: files = os.listdir(path.encode('utf-8')) shutil.move(src.encode('utf-8'), dst.encode('utf-8'))

m0n4 commented 6 years ago

Thanks GammaC0de It doesn't work : 'ascii' codec can't decode byte 0x92 in position 16: ordinal not in range(128) Maybe I could make it call a batch script ?

GammaC0de commented 6 years ago

If you are going to use a batch script then you do not need the python script..

Also, try to download with a pure ASCII (English) file name.

m0n4 commented 6 years ago

Thank you again GammaC0de ! if it could help someone: (please note that Vidéos becomes Vid‚os)

ECHO off
robocopy /MOVE /s C:\Users\user\Downloads\PyLoad\ "\\FREEBOX_SERVER\Disque dur\Vid‚os\Pyload" /XD