【问题标题】:Can't print using p4python无法使用 p4python 打印
【发布时间】:2013-12-31 18:57:05
【问题描述】:

我不确定这是 P4API 的错误还是我使用 p4python 的问题。

p4.run_print("-q", "-o " + targetPath, depotFile + "#" + rev)

...给出一个例外。

Traceback (most recent call last):
  File "C:\pyTools\p4test.py", line 218, in <module>
    main()
  File "C:\pyTools\p4test.py", line 70, in main
    copy_changes(p4, args.copy[0], args.copy[1], clientStream, targetRoot)
  File "C:\pyTools\p4test.py", line 204, in copy_changes
    p4_print_to_path(p4, change['depotFile'][i], change['rev'][i], targetPath) # Get the file@rev at the target path
  File "C:\pyTools\p4test.py", line 215, in p4_print_to_path
    p4.run_print("-q", "-o " + targetPath, depotFile + "#" + rev)
  File "C:\Python33\lib\site-packages\P4.py", line 610, in run_print
    raw = self.run('print', args, **kargs)
  File "C:\Python33\lib\site-packages\P4.py", line 533, in run
    result = P4API.P4Adapter.run(self, *self.__flatten(args))
P4.P4Exception: [P4#run] Errors during command execution( "p4 print -q -o C:/_code/target\PurleyPkg\Tool\GenBiosId\BiosIdD.env //CP_Server_BIOS/Skylake_Trunk/PurleyPkg/Tool/GenBiosId/BiosIdD.env#35" )

        [Error]: "can't create directory for  C:/_code/target\\PurleyPkg\\Tool\\GenBiosId\\BiosIdD.env\nmkdir:  C:: The filename, directory name, or volume label syntax is incorrect. "

如果我复制该行并在命令提示符下使用它,它可以正常工作。

p4 print -q -o C:/_code/target\PurleyPkg\Tool\GenBiosId\BiosIdD.env //CP_Server_BIOS/Skylake_Trunk/PurleyPkg/Tool/GenBiosId/BiosIdD.env#35

...这创建了文件的路径并正确复制了文件。所以,看起来我已经正确地形成了对 API 的调用。 我在这里做错了吗? 这与 Python 3.x 和 Python 2.x 有关吗?我没有尝试过 2.x。 有没有人可以通过 p4python 模块使用 print 命令?

我找不到 P4API 的来源(不确定该部分是否公开)。我有 p4python 源代码,但调试路径在第 533 行结束,调用了我只有二进制文件的 P4API。

我无法使用 perforce 找到此模块的公共错误跟踪器。那里有一个指针,以便我可以搜索他们的错误并提交一个也将不胜感激。

【问题讨论】:

    标签: perforce perforce-client-spec p4python


    【解决方案1】:

    syntax for this command 具有误导性:

    p4 [g-opts] print [ -a -A -o outfile ] [ -q ] file[revRange] ...
    

    -o 和输出文件的开头之间没有空格。我在这个问题中的问题是我在'-o'之后添加了一个空格

    "-o " + targetPath
    

    删除空格解决了这个问题。

    【讨论】:

    • 嗯,我打算建议尝试p4.run_print("-q", "-o", targetPath, depotFile + "#" + rev)。如果有机会,你也可以试试吗?我猜测由于 P4 解析参数的方式,删除空间恰好起作用。
    • 是的,p4.run_print("-q", "-o", targetPath, depotFile + "#" + rev) 也可以。 p4.run_print("-q", "-o ", targetPath, depotFile + "#" + rev) 不起作用(也许这是预期的)。
    猜你喜欢
    • 2014-11-25
    • 1970-01-01
    • 2019-08-01
    • 2012-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多