-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Open configuration file with utf-8 encoding on Windows and Python 2 #2219
Open configuration file with utf-8 encoding on Windows and Python 2 #2219
Conversation
if osp.isfile(fname): | ||
try: | ||
with codecs.open(fname, encoding='utf-8') as configfile: | ||
self.readfp(configfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you decide to use readfp
instead of read
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read() expects filename and does file open itself, readfp() expects open file handle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I thought that was the case. So codecs.open
returns the file handle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, exactly
@vasily-smirnov, thanks a lot your contribution! Let's hope this finishes all the problems we've had with non-ascii accounts on Windows :-) I just have a minor (clarification) comment before merging |
@vasily-smirnov, I think changing |
done as you suggested, not tested |
I tested it and unfortunately is not working. Sorry for making you waste your time, but please revert to use |
no problem, done, thanks for testing |
Open configuration file with utf-8 encoding on Windows and Python 2
Thanks a lot for your work. |
de nada! I like spyder very much :-) |
Muchas gracias ;-) |
This change is related to issue 2081 for the case when user home directory contains non-ascii characters and Spyder reads/writes INI file into that directory.
This change does NOT resolve the issue 2081 (there are cases with non-ascii working directory and plus some dependencies out of Spyder codebase).
This change seems failsafe.
Fixes #2081