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

Opening another file in a running Spyder from the terminal fails in Python 3 #1479

Closed
spyder-bot opened this issue Feb 17, 2015 · 4 comments
Closed

Comments

@spyder-bot
Copy link
Collaborator

From tak...@gmail.com on 2013-07-05T17:35:26Z

This is with a dev checkout of Spyder, testing on Python 3 (3.2 on this machine, but I'll take an educated guess that it would be the same in 3.3)

What steps will reproduce the problem?

  1. Start Spyder, and leave it running. Ensure single instance mode is on.
    1. From a separate terminal, run 'spyder some_file.py' What is the expected output? What do you see instead? The file should be opened in the existing Spyder window. Instead I get a traceback:

Traceback (most recent call last):
File "/usr/local/bin/spyder", line 3, in
start_app.main()
File "/usr/local/lib/python3.2/dist-packages/spyderlib/start_app.py", line 81, in main
send_args_to_spyder(args)
File "/usr/local/lib/python3.2/dist-packages/spyderlib/start_app.py", line 34, in send_args_to_spyder
client.send(osp.abspath(arg))
TypeError: 'str' does not support the buffer interface

It's trying to send a unicode str object through a raw socket. It's simple enough to encode it to bytes, but it needs some care with encoding and decoding at the other end to ensure that filenames with non-ascii characters can be opened.

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1479

@spyder-bot
Copy link
Collaborator Author

From tak...@gmail.com on 2013-08-13T19:05:43Z

I think this patch should work. I've tested it on Python 3.3 and 2.7, opening files with non-ascii characters in the name both while launching Spyder and by sending the arguments across to a single-instance Spyder process. It could do with testing on Windows, but I believe it should work there too.

Attachment: open_external_files_unicode.patch

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2013-08-14T01:40:37Z

I'm about to apply your patch to default branch (successfully tested on Windows 8 with both Python 2.7 and Python 3.3). Thanks a lot for taking the time to test this.

I've made a modification regarding the changes in spyder.py: I'm using the "to_unicode_from_fs" function from spyderlib.utils.encoding which was doing exactly the same as you wrote initially around line 1750.

Status: Started
Owner: pierre.raybaut

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2013-08-14T01:42:31Z

This issue was updated by revision b31773be9d3d .

Status: Fixed

@spyder-bot
Copy link
Collaborator Author

From tak...@gmail.com on 2013-08-14T12:16:16Z

Thanks Pierre. Yes, that to_unicode_from_fs function is just the ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant