Skip to content
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

PR: Fixed encoding issue when changing cwd in the IPython console #3813

Merged
merged 4 commits into from
Dec 10, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spyder/utils/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def log_last_error(fname, context=None):
print("Context", file=fd)
print("-------", file=fd)
print("", file=fd)
print(context, file=fd)
print(u' '.join(context).encode('utf-8').strip(), file=fd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you have to do this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was needed because an error was thrown in the python console when changing the directory to one with non - ascii name. Actually was really strange when I saw it. I also saw that the error causes that a process in the python console crashes and then, if you try to change again the working directory, Spyder crashes too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the crash only occurs on Python 2? Or on Python 3 too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only occurs with Python 2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then please apply this change only for Python 2 and leave the previous line for Python 3

print("", file=fd)
print("Traceback", file=fd)
print("---------", file=fd)
Expand Down
2 changes: 1 addition & 1 deletion spyder/widgets/ipythonconsole/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def is_running(self):
def set_cwd(self, dirname):
"""Set shell current working directory."""
return self.silent_execute(
"get_ipython().kernel.set_cwd(r'{}')".format(dirname))
u"get_ipython().kernel.set_cwd(r'{}')".format(dirname))

# --- To handle the banner
def long_banner(self):
Expand Down