Skip to content

Conversation

michaelhidalgo
Copy link

Fixing bug #442, which occur because Windows paths are not quoted properly. If the user path has special chararacters ( parenthesis or spaces), jupyter_core breaks.

raise OSError(msg, errno.ENOENT)
p = Popen([cmd_path] + argv[1:]) # noqa: S603
# Quoting path in Windows
cmd_line = f'"{cmd_path}"' + "".join(f' "{arg}"' for arg in argv[1:])
Copy link
Member

Choose a reason for hiding this comment

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

This definitely will not be correct when arg contains quotes. Passing a list to Popen should result in proper quoting. If it doesn't, I think this is a bug in Python itself.

Instead of building quoted strings by hand, we should always use libraries like shlex to make sure it's done correctly or in a platform-independent way (in fact, that is why we pass a list to Popen, so I'm not sure what's going wrong here)

Can you check if Popen(["some path", "with spaces"]) works for you without any Jupyer calls?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants