Jump to content


p4python: Issues with -T and fstat

p4python fstat

  • Please log in to reply
1 reply to this topic

#1 jkriegshauser

jkriegshauser

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 04 May 2015 - 10:48 PM

Hi there!

I'm trying to go through a list of results from 'p4 have' and get some additional information from each. I'm trying to get the fileSize and headTime fields.

This isn't working:
>>> fstat = p4.run_fstat('-T', 'headTime', 'fileSize', have[0]['depotFile'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\P4.py", line 463, in <lambda>
return lambda *args, **kargs: self.run(cmd, *args, **kargs)
File "C:\Python27\lib\site-packages\P4.py", line 536, in run
result = P4API.P4Adapter.run(self, *self.__flatten(args))
P4.P4Exception: [P4#run] Warnings during command execution( "p4 fstat -T headTime fileSize //depot/testfile.txt" )
	 [Warning]: 'fileSize - no such file(s).'

Nor is this:
>>> fstat = p4.run_fstat('-T', '"headTime, fileSize"', have[0]['depotFile'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\P4.py", line 463, in <lambda>
return lambda *args, **kargs: self.run(cmd, *args, **kargs)
File "C:\Python27\lib\site-packages\P4.py", line 536, in run
result = P4API.P4Adapter.run(self, *self.__flatten(args))
P4.P4Exception: [P4#run] Errors during command execution( "p4 fstat -T "headTime, fileSize" //depot/testfile.txt" )

[Error]: 'Field "headTime doesn\'t exist.'

Nor this:

>>> fstat = p4.run_fstat("-T \"headTime, fileSize\"", have[0]['depotFile'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\P4.py", line 463, in <lambda>
return lambda *args, **kargs: self.run(cmd, *args, **kargs)
File "C:\Python27\lib\site-packages\P4.py", line 536, in run
result = P4API.P4Adapter.run(self, *self.__flatten(args))
P4.P4Exception: [P4#run] Errors during command execution( "p4 fstat -T "headTime, fileSize" //depot/testfile.txt" )

[Error]: 'Field "headTime doesn\'t exist.'

How can I query multiple field from fstat?

#2 P4Norman

P4Norman

    Advanced Member

  • Staff
  • 81 posts
  • LocationOakland CA, USA

Posted 08 May 2015 - 12:03 AM

Have you tried this?   (I haven't, yet....)

>>> fstat = p4.run_fstat('-T', 'headTime, fileSize', have[0]['depotFile'])

You want the argument to "-T" to be a comma delimited string, so the string needs to be parsed as a single argument, I think in your second example you quoted the entire string twice which caused parsing problems. Let me know if this works for you.





Also tagged with one or more of these keywords: p4python, fstat

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users