Let Figure.savefig support filenames with spaces#1116
Conversation
See my comment at #804 (comment) on how to fix the space issue. If the tests pass, do we still need this PR? |
|
Nice fix in #804 (comment). I think this PR is still needed for people who want to use spaces. It's allowed in GMT (https://docs.generic-mapping-tools.org/dev/begin.html#examples). |
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
|
@weiji14 Any other concerns? |
|
Ping @GenericMappingTools/pygmt-contributors for comments if we should allow whitespace in figure names. |
I think so and this PR is simple enough. |
weiji14
left a comment
There was a problem hiding this comment.
I'm still reluctant to allow spaces since it adds an if-clause to the code, but ok with supporting it if three or more people agree.
I think it is good to allow this. I'm glad there is the disclaimer that spaces in filenames isn't recommended, but better to increase compatibility. |
…#1116) Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Description of proposed changes
Figure.savefig()doesn't work if filenames contain spaces.Here is an minimal example to reproduce the issue:
This PR fixes the issue by adding double quotes around filenames.
NOTE: Using filenames with spaces is NOT recommended.
However, we have to support it, because sometimes filenames of some
baseline images must contain spaces.
See https://github.com/GenericMappingTools/pygmt/runs/2179626599 for an example failure.
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash commands are:
/format: automatically format and lint the code/test-gmt-dev: run full tests on the latest GMT development version