Jump to content


P4Python files api will not take -e flag

P4Python

  • Please log in to reply
1 reply to this topic

#1 tof

tof

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 20 May 2014 - 06:36 PM

I've got the P4Python api installed and running on an ubuntu precise vagrant machine using python 3.3

I'm attempting to generate the following command:

p4 files -e //depot/path/*

in order to list all the non-deleted files in //depot/path

The command works as expected from the command line, but I have been unable to replicate it using the P4Python api.

This command works (p4.connect() has been successful)


folder = '//depot/path'

p4.run('files', '{0}/*'.format(folder))

however, it also returns deleted depot files, so I would like to add the '-e' option to the command.

I've tried the following variations:
p4.run('files', '-e', '{0}/*'.format(folder))
p4.run('files -e', '{0}/*'.format(folder))
p4.run('files', '-e {0}/*'.format(folder))
p4.run('files', '{0}/*'.format(folder), '-e')

No matter where I add the -e the p4.run call no longer produces any output.


Is there any way to exclude deleted files from the results of the command?

#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 21 May 2014 - 09:44 PM

Your first example should have worked. Here's an example I just ran successfully:

from P4 import P4, P4Exception
p4 = P4()
try:
  p4.connect()
  p4.exception_level = 1	# ignore "File(s) up-to-date"
  files = p4.run_files('-e', '//depot/dev/matt/scripts/...' )
  print(files)
except P4Exception:
  for e in p4.errors:
	print( e)
finally:
  p4.disconnect()






Also tagged with one or more of these keywords: P4Python

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users