Problem with unicode radula output to pipe
Using radula ls with a bucket that contains Unicode named objects works fine, but directing it to a pipe results in an error:
radula ls testbucket
works fine, while this doesn't:
radula ls testbucket | grep teststring
Traceback (most recent call last):
File "/usr/bin/radula", line 11, in
I could get rid of this error by adding:
reload(sys)
sys.setdefaultencoding('utf8')
to /usr/bin/radula
Now the listing works find, but still can't put a file named "testfile[bracketstest]"
radula put "testfile\[bracketstest\]" mustafa-test/
Error: No file(s) to upload: used testfile\[bracketstest\]
Sorry, closed by mistake
Also without escaping:
radula put "testfile[bracketstest]" mustafa-test/
Error: No file(s) to upload: used testfile[bracketstest]
I found this approach highly discouraged: https://stackoverflow.com/questions/3828723/why-should-we-not-use-sys-setdefaultencodingutf-8-in-a-py-script
Instead, setting environment variable PYTHONIOENCODING="UTF-8" fixes the problems
not for nothing, but radula appears to work ok with Japanese characters ok.
$ radula -p abibby up "そうかな" abibby/toss/
2018-01-08 16:31:29,268 INFO:radula: CHUNKS: 1 parts x 100.00 MB
2018-01-08 16:31:30,375 INFO:radula: Finished uploading 9.00 B in 0.44s (20.49 Bps)
2018-01-08 16:31:30,376 INFO:radula: Download URL: https://s3-v2/abibby/toss/%E3%81%9D%E3%81%86%E3%81%8B%E3%81%AA
I think what you've hit is an accidental fnmatch pattern. Characters within brackets will match a single character among the set.
One workaround is to use another fnmatch pattern (the ? char) to avoid typing a bracket ; at least until a better solution reveals itself.
$ radula -p abibby up "brackets?test?" abibby/toss/
2018-01-08 16:35:54,164 INFO:radula: CHUNKS: 1 parts x 100.00 MB
2018-01-08 16:35:55,236 INFO:radula: Finished uploading 10.00 B in 0.38s (26.48 Bps)
2018-01-08 16:35:55,236 INFO:radula: Download URL: https://s3-v2/abibby/toss/brackets%5Btest%5D
Thanks exporting PYTHONIOENCODING="UTF-8" fixed the problem with some characters, but the [ is still problematic, any idea?