printing unicode strings to console of file

Thanks for the informative and well written page.
I've been trying to write a script that renames files. Basically:
1. reading the files with os.listdir('.') # also tried (u'.')
2. manipulate filenames
3. print "mv \"" + src + "\" \"" + dst + "\"
The weird problem is that it prints to the console, but when I try to redirect the output to a file "script > /tmp/a" I get the following:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-15: ordinal not in range(128)
any clue?

thanks,
hanan

Reply

The content of this field is kept private and will not be shown publicly.