程序员英语 04:读报错、搜索与求助
看到 Permission denied 就重装软件,通常跳过了最有价值的信息:谁对哪个资源做什么时被拒绝。英文报错阅读可以先拆成“动作、对象、失败条件”,再沿调用链寻找证据。
逐层拆开错误
下面是原创的虚构转换器日志:
export failed: could not open output/report.csv: permission denied最外层 export failed 是用户可见任务;could not open 是失败动作;output/report.csv 是目标;permission denied 是操作系统返回的原因类别。它并不直接证明是哪一种权限配置出错,也不能证明导出代码本身没有问题。
先写一个准确的英文复述:The export fails when the tool opens the output file. 再写假设:The process may not have write access to the output directory. 第一行是现象,第二行有 may,说明尚待验证。
| 常见表达 | 能说明什么 | 不能单独证明什么 |
|---|---|---|
| not found | 某个查找没有找到目标 | 目标一定从未存在 |
| timed out | 在限定时间内未完成 | 远端已经宕机 |
| connection refused | 连接遭到拒绝 | 唯一原因就是防火墙 |
| invalid argument | 参数不被接受 | 所有参数都错误 |
| out of memory | 某次内存需求未能满足 | 一定存在内存泄漏 |
搜索时保留稳定信息
好的搜索式包含工具名、版本或平台、错误中的稳定片段。例如虚构工具 filepack 的问题可以先搜:
filepack "permission denied" output Windows
filepack output directory permissions documentation引号适合短且稳定的错误片段。先去掉随机文件名、请求 ID、时间戳等噪声,但在本地保留完整日志。结果太少时逐步放宽,不要把整个多行堆栈一次塞进搜索框。
阅读搜索结果时,核对版本和触发条件;“有人重装后解决”不等于找到了你的原因。可优先查官方排障文档,再看维护者确认的 Issue。对答案中的命令,先理解作用与影响,再决定是否适用于自己的环境。
求助文本:让对方能开始验证
下面的数据全部为教学假设:
I am using filepack 2.4 on Windows 11.
Exporting to output/report.csv fails with "permission denied".
Exporting the same input to a directory I own succeeds.
I expected the tool to create the report in either directory.
Could you help me identify which permissions the output directory needs?第一句给环境,第二句给现象,第三句给对照实验,第四句给预期,第五句给具体问题。若还没做过第三句的实验,就改成计划 I will check whether exporting to a directory I own succeeds.,不能为了让求助显得完整而编造测试结果。
练习:改写一个模糊问题
原文:It doesn't work. I think your code is broken. Please fix it.
已知信息:虚构工具 2.4;输入有一条空记录;默认模式退出;删除空记录后可完成;预期跳过空记录。写 4~6 句英文求助,并提出一个尚待核对的问题。
查看答案与讲解
一种答案:
With filepack 2.4, the import exits when the input contains an empty record.
Removing that record allows the import to finish.
I expected the default mode to skip empty records.
I have attached a minimal input with the same behavior.
Does this version distinguish an empty record from a blank line?最后一句没有断言程序一定错误,而是询问术语边界。真实使用时,仅在实际附上材料后保留 I have attached。原题未提供平台,不能随意补写。
资料与延伸
Google 错误信息写作课程 从错误信息的读者出发,讨论如何说明问题与解决办法。反过来阅读日志时,也可以检查消息缺少的是失败对象、条件还是下一步。
继续阅读
- 读写与对话练习
- 句法与表达查阅
- 句法与表达查阅