python - 尝试使用 code_swarm 但我在 osx 上使用 perforce 时遇到了一些 python 脚本问题

标签 python macos perforce code-swarm

我在运行时遇到问题:

link-mbp:codeswarm-0.1 benb$ python convert_logs/convert_logs.py -perforce-path
Traceback (most recent call last):
File “convert_logs/convert_logs.py”, line 408, in
main()
File “convert_logs/convert_logs.py”, line 350, in main
files = run_marshal(’p4 -G describe -s “‘ + changelist['change'] + ‘”‘)
KeyError: ‘change’
link-mbp:codeswarm-0.1 benb$

我正在尝试通过此链接使用 code_swarm http://blog.perforce.com/blog/?p=780&cpage=1#comment-965可视化我的代码库更改。

如果我运行 p4 changes 一切都显示正确但是这个 python 脚本中的代码似乎没有正确处理...

如果我在更改列表编号上运行 p4 describe,它会正确报告

想法?

最佳答案

我遇到了完全相同的问题。不是 python 专家,我在第 350 行使用打印语句调试脚本,如下所示:

for changelist in changelists:
    print changelist # <-- here
    files = run_marshal('p4 -G describe -s "' + changelist['change'] + '"')

这揭示了我的问题 - 我使用了一个像 p4='p4 -C utf8' 这样的别名来将字符集传递给 perforce。因此,当我从命令行运行它时,别名被处理并且 describe 命令工作得很好,但是当从 python 调用时,别名没有被处理。我只是通过在 python 脚本的两个位置将 'p4' 替换为 'p4 -C utf8' 来破解脚本。

您的问题可能相同或不同,但希望这能帮助您快速调试!

关于python - 尝试使用 code_swarm 但我在 osx 上使用 perforce 时遇到了一些 python 脚本问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2555481/

相关文章:

macos - 减少 xcodebuild 写入命令行的数量

mercurial - 将 Mercurial 与 Perforce 结合使用

python - 保存图形时颜色条无法完全显示

python - 将一个表面位 block 传输到另一个表面上而不合并 alpha

python - 只能连接 str 不能列表到 str

macos - 如何在 Mac 上安装 xampp

objective-c - 如何将多个窗口组合在一起并将它们放置到屏幕上的特定位置?

python - Pandas 基于非唯一列匹配创建一个新列,连接字符串

version-control - 微软商店中的 Perforce

Perforce:防止 Perforce 改变文本文件格式