Question

I am not certain if this is a bug with P4API or a problem with my usage of p4python.

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

...gives an exception.

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. "

If I copy the line and use it at the command prompt, it works fine.

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

...this created the path to the file and copied the file correctly. So, it looks like I have correctly formed the call to the API. Am I doing something wrong here? Is this related to Python 3.x vs Python 2.x? I have not tried with 2.x. Has anyone been able to use the print command through the p4python module?

I could not find the source to the P4API (not sure if that part is public). I have the p4python source, but the debug path ends at line 533 with the call into P4API which I only have as a binary.

I could not find a public bug tracker for this module with perforce. A pointer there so I can search their bugs and maybe submit one would also be appreciated.

Was it helpful?

Solution

The syntax for this command is misleading:

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

There is no space between the -o and the start of the outfile. My problem in this question was that I added a space after the '-o'

"-o " + targetPath

Removing the space fixed this issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top