fix: quote paths inside ChimeraX --cmd script to handle spaces#106
Merged
Conversation
The previous argv-list refactor bypassed the OS shell but the path tokens were still inlined unquoted into the ChimeraX --cmd script. ChimeraX's own command parser still split on whitespace, so an output dir or build folder containing a space (e.g. user-chosen output paths) would break "open" and "save" commands silently — no PNG, no Python-level error. Wrap pdb_path, attr_file_path, and output_path in double quotes before interpolation so ChimeraX treats each as a single token. Paths with embedded double quotes are not supported; build-datasets wouldn't accept them either. Also tightened the _run_chimerax docstring to accurately describe what the argv-list change does and doesn't cover. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes ChimeraX --cmd script parsing when file paths contain spaces by quoting the paths embedded inside the ChimeraX command string (separate from the OS-level argv parsing introduced in PR #105).
Changes:
- Clarifies
_run_chimerax()docstring to distinguish OS argv parsing (shell=False) from ChimeraX--cmdparsing. - Quotes
pdb_path,attr_file_path, andoutput_pathwithin the ChimeraX--cmdscript so ChimeraX treats them as single tokens even with spaces.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #105 switched the ChimeraX invocation to an argv list +
shell=False, which bypasses the OS shell. But path tokens were still inlined unquoted into the ChimeraX--cmdscript, so ChimeraX's own parser would still split on whitespace. An output dir or build folder containing a space (e.g. user-chosen output paths) would silently break theopen/savecommands — no PNG, no Python-level error.Wrap
pdb_path,attr_file_path, andoutput_pathin double quotes before interpolation so ChimeraX treats each as a single token. Paths with embedded double-quote characters are not supported.Also tightened the
_run_chimeraxdocstring so it accurately describes which parsing layer the argv-list change covers.