BitcasaFileLister icon indicating copy to clipboard operation
BitcasaFileLister copied to clipboard

'ascii' codec can't encode character u'\xe4' in

Open ghost opened this issue 12 years ago • 16 comments

11/10 11:27:16 [Queuer 26][ERROR]: Error. Could not write to d:\temp\bitcasa\skippedfiles.csv. Ending Traceback (most recent call last): File "C:\Users\root\Desktop\BitcasaFileLister-master\includes\helpers\results.py", line 24, in writeSkipped myfile.write("%s||%s\n" % (tfd, base64_path)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 11: ordinal not in range(128)

It's a showstopper. After that error all Threads are quitted.

ghost avatar Nov 10 '14 10:11 ghost

Exception in thread Download 32: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner self.run() File "C:\Python27\lib\threading.py", line 763, in run self.__target(*self.__args, **self.__kwargs) File "BitcasaFileFetcher\threads\download.py", line 60, in download filehash = sha1("blob " + str(size_bytes) + "\0" + temp_file) UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 71: ordinal not in range(128)

ghost avatar Nov 10 '14 10:11 ghost

When it was using unidecode, all characters were in asii. But now it can have all characters in system locale. And afaik sha1 function does not handle unicode string - only takes strs and bytes.

ekoekoazarak avatar Nov 10 '14 15:11 ekoekoazarak

WIP

reallistic avatar Nov 10 '14 16:11 reallistic

This should be fixed by 80182954a4b037e84250349b3536f0144ca00bdd

If not, please ask to reopen and be sure to include the characters that couldn't be converted. Also, due to the fix for sha1 hashes, any partial downloads will NOT be recognized

reallistic avatar Nov 10 '14 17:11 reallistic

Just in case please see the important edit above.

reallistic avatar Nov 10 '14 17:11 reallistic

11/10 18:48:34 [Queuer 71][ERROR]: Error. Could not write to d:\temp\bitcasa\skippedfiles.csv. Ending Traceback (most recent call last): File "C:\Users\root\Desktop\BitcasaFileLister-master\includes\helpers\results.py", line 24, in writeSkipped myfile.write("%s||%s\n" % (tfd, base64_path)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 11: ordinal not in range(128) 11/10 18:48:34 [Queuer 71][INFO]: Shutting down 11/10 18:48:34 [Queuer 54][INFO]: Shutting down 11/10 18:48:34 [Queuer 47][INFO]: Shutting down 11/10 18:48:34 [Queuer 45][INFO]: Shutting down

Version 0.6.1

ghost avatar Nov 10 '14 17:11 ghost

And I specifically tested that character. Weird. Can you provide the filename?

reallistic avatar Nov 10 '14 17:11 reallistic

Käpt'n Blaubär Seemannsgarn

The ' seems to be the problem :-|

ghost avatar Nov 10 '14 17:11 ghost

Super weird. I will check it out

reallistic avatar Nov 10 '14 18:11 reallistic

As far as I know its a little bit tricky to escape ' in python :-D

ghost avatar Nov 10 '14 18:11 ghost

Wow. i just had an epiphany. Yeah I know how to fix that. Its already fixed actually in one place but I didn't carry it over to others.

reallistic avatar Nov 10 '14 18:11 reallistic

I'm really looking forward for fixing that.

The "resume Downloads" option is the last hope for me to save all of my Files.

ghost avatar Nov 11 '14 06:11 ghost

In case anyone is interested in an explanation: Bitcasa is already sending valid utf-8 (or so I assume). json.loads(response) turns that into unicode (how about that. Was totally unaware). This means, I was dancing in circles trying to convert what I thought was a bytestring to unicode to convert back to a "valid" bytestring when all along all I had to do was use codecs.open to write the unicode directly to the error/skipped/success files with no conversion necessary.

Update coming soon

reallistic avatar Nov 12 '14 01:11 reallistic

@cappa83 @traumender @SoySoy22 Have any of you had issues with the results.py writing success/skipped/failures in this version?

reallistic avatar Nov 13 '14 03:11 reallistic

Nop, for me it works flawlessly...

ghost avatar Nov 13 '14 05:11 ghost

Great! I'll call this 1 closed as fixed by d5f7407623dfa19b90a34665233595b68890ac85.

reallistic avatar Nov 13 '14 05:11 reallistic