P4Python use argument -I Indicators

Question:

I would like to use the -I argument to know what is happening other than just exceptions when I sync using p4python.

The website says I can use -I for progress indicators as a console command, particularly with p4 -I sync -q.

This works in console, but I wasn’t able to get it to work with P4Python, but perhaps I just didn’t use it right and couldn’t find any info about using it.

Do anyone know how to do this?

Asked By: Goose

||

Answers:

Take a look at the Progress class referenced here:

https://www.perforce.com/perforce/doc.current/manuals/p4script/03_python.html#1131357

You probably currently have some code that looks like:

p4.connect()
p4.run_sync()

To get progress indicators, create a Progress class:

class GoosesAwesomeProgressSubclass(P4.Progress):
    def update(self,units):
        print("Progress has been made!")

and use it:

p4.progress = GoosesAwesomeProgressSubclass()
p4.connect()
p4.run_sync()
Answered By: Samwise