bbolli / tumblr-utils

Utilities for dealing with Tumblr blogs, Tumblr backup
GNU General Public License v3.0
668 stars 124 forks source link

Output option: can't write to folder with non Latin characters #12

Closed WyohKnott closed 10 years ago

WyohKnott commented 10 years ago

Hello,

I'm trying to backup to a folder containing Cyrillic characters and it does not work as expected. For example:

tumblr_backup.py   -O "..\Алан" bboli

outputs

WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect

But Windows Explorer does handle those characters. Is there a workaround to it?

Thanks.

bbolli commented 10 years ago

Does the directory exist already? What if you remove the quotes around its name?

WyohKnott commented 10 years ago

The directory does not exist, and removing quotes does not change anything.

bbolli commented 10 years ago

After a few tests, it looks like CMD.EXE doesn't pass the cyrillic characters to Python properly.

This test script:

import sys
for c in sys.argv[1]:
    print '%X' % ord(c),
print

outputs 2E 2E 5C 3F 3F 3F 3F when passing your -O argument as parameter, the 3Fs are question marks. I don't even know if non-latin characters are supported as command-line arguments. Can you try to start the backup from a managed application, e.g. PowerShell?

PS: I have only limited access to a Windows machine, so my replies may take a while...

WyohKnott commented 10 years ago

I've tested with Powershell and it gives the same results, for both the backup and test script.

I've dig around and I've found a question on StackOverflow that explains the situation:

http://stackoverflow.com/questions/846850/read-unicode-characters-from-command-line-arguments-in-python-2-x-on-windows?lq=1

I guess I need to find a better console than the Windows ones.

bbolli commented 10 years ago

Won't fix; there's nothing I can do to fix this.