-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smart quotes cause --list to fail #86
Comments
This sounds like it might have an ugly workaround - while it recommends not using the print statement, I have to believe that print is necessary under the current design for PyiCloud: Ugh, further discussion emphasizes that a global solution is bad (some modules and libraries require ASCII encoding), so the only way I can think to attack it is (a) choose the encoding line by line, which means every time someone reports utf-8 characters in some string, that print() statement has to be patched, or (b) patch print() throughout PyiCloud and pray nothing breaks. Man, you can't (get an easy) win in the real world. |
Or how about using the logging module instead of simple |
Oh, this shouldn't be that big of a deal; we should really just be |
From a (very) brief glance at the code it appears to me that pyicloud already uses logging (at least in base.py). So why not use a logger in the cmdline as well? # using
print("It is now {}".format(datetime.utcnow()).encode(sys.stdout.encoding))
# instead of
logger.info("It is now {}".format(datetime.utcnow()))
# makes for a lot of redundant code You could write your own print method old_print = print
def my_print(output):
old_print(output.encode("UTF-8"))
print = my_print Ok, I got a little side-tracked there, but in the end you should keep in mind, some terminals have ascii default encoding. |
Does the new version fix the issue ? |
Calling
icloud --list
causes a stack trace with my iCloud account because one of my devices has a smart quote (single backtick) in its name:The text was updated successfully, but these errors were encountered: