Apostrophes in filenames are incorrectly converted to octal codes
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
先阅读 build_arg_list 使用的参数构建代码和 PR #4987 中的讨论。追踪文件名选项如何转义,然后添加一个回归测试,证明文件路径中的撇号保持原样;所提供的示例可以复现该故障。测试通过且包含撇号的文件路径原样传递给 GMT 后,即完成。
由索引模型根据 Issue 内容生成。
描述
Description of the problem
On Windows, sphdistance returns normally for outgrid="cell's.nc", but the file is missing. Using cells.nc produces the expected grid. I also reproduced this with grdcut. The native GMT CLI wrote cell's.nc successfully, and its grid matched the PyGMT control at all 18 points.
build_arg_list({"G": "cell's.nc"})[0] returns r"-Gcell\234s.nc". The apostrophe has been converted to a PostScript escape before the filename reaches GMT. File options need the literal path. Discussion in #4987
Minimal Complete Verifiable Example
from pathlib import Path
from tempfile import TemporaryDirectory
import pygmt
with TemporaryDirectory() as tmp:
for name in ("cells.nc", "cell's.nc"):
path = Path(tmp) / name
pygmt.sphdistance(
x=[85.5, 82.3, 85.8, 86.5],
y=[22.3, 22.6, 22.4, 23.3],
region=[82, 87, 22, 24],
spacing=1,
outgrid=path,
)
assert path.is_file(), name
Full error message
GMT writes the following diagnostic to stderr on Windows. The temporary directory is abbreviated.
sphdistance (gmtapi_export_grid): Not a supported grid format [<temp>\cell\234s.nc]
[Session pygmt-session (5)]: Error returned from GMT API: GMT_GRID_WRITE_ERROR (19)
[Session pygmt-session (5)]: Error returned from GMT API: GMT_GRID_WRITE_ERROR (19)
[Session pygmt-session (5)]: Error returned from GMT API: GMT_GRID_WRITE_ERROR (19)
The second assertion raises AssertionError: cell's.nc.
System information
Reproduced with the PyGMT v0.19.0 wheel and with main at f0c88198e6543f21bc4f7f1eca3f5359f9d9b20e. The following pygmt.show_versions() output is from v0.19.0, with local installation paths shortened.
PyGMT information:
version: v0.19.0
System information:
python: 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
executable: <venv>/Scripts/python.exe
machine: Windows-11-10.0.26300-SP0
Dependency information:
numpy: 2.2.6
pandas: 2.3.3
xarray: 2026.9.0
packaging: 26.4
contextily: None
geopandas: None
IPython: None
pyarrow: None
rioxarray: None
gdal: 3.12.4
ghostscript: 10.07.1
GMT library information:
version: 6.8.0
padding: 2
share dir: <GMT>/share
plugin dir: <GMT>/bin/gmt_plugins
library path: <GMT>/bin/gmt.dll
cores: 32
grid layout: rows
image layout:
binary version: 6.8.0
- 主要语言
- Python
- 星标
- 882
- 派生
- 261
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 29
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
GenericMappingTools/pygmt 的其他 Issue
-
discussions documentation
难度 1/5 1 小时以内 新手友好度 78/100
GenericMappingTools/pygmt#4992 ·
维护者通常 1 天内回复
-
Improve reporting the GMT version via "pygmt.show_versions()"可能已有人在做 @yvonnefroehlich 于 113 天前认领。 未关闭maintenance
难度 2/5 1-3 小时 新手友好度 68/100
GenericMappingTools/pygmt#4812 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
GenericMappingTools/pygmt#4765 ·
维护者通常 1 天内回复
-
Add an AGENTS.md file可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭discussions
难度 2/5 1-3 小时 新手友好度 75/100
GenericMappingTools/pygmt#4677 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
discussions maintenance
难度 5/5 一周以上 新手友好度 35/100
GenericMappingTools/pygmt#5006 · 2 条评论 ·
维护者通常 1 天内回复
查看 GenericMappingTools/pygmt 的全部 Issue
相似的 Issue
-
accepted
难度 2/5 1-3 小时 新手友好度 67/100
future-agi/future-agi#5274 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
w3c/feedvalidator#204 ·
-
[BUG][Low–Medium] founder_numbers.py silently reads a SAFE discount or pool target given as a fraction (0.2) as 0.2%可能已有人在做 @sumitkhond111-del 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
bmad-code-org/BMAD-METHOD#3358 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
open-mmlab/mmcv#3352 ·
-
难度 1/5 1 小时以内 新手友好度 68/100
OpenGithubs/weekly#263 ·
维护者通常 1 天内回复