2

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?

1 Answer 1

1

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()
Sign up to request clarification or add additional context in comments.

14 Comments

That's great info. Though I'm having trouble using it. Should I be setting progress somehow or using a progress method for every sync or using a custom progress class somehow?
There's a progress class described in that link (P4.Progress). You subclass it and the server will invoke callbacks to communicate the progress to you.
So I tried this class MyProgress( Progress ): pass foo = MyProgress() but I feel like that might be entirely wrong and I didn't see any progress being returned. Do I need to put anything in the subclass? Also, please forgive my lack of knowledge.
btw I used: from P4 import P4, P4Exception, Progress and it doesn't throw any errors, but it doesn't seem to give progress indicators
I added some handwavy example code to give you the idea of how you're supposed to use the Progress class (I think -- I haven't actually used it, just going off the documentation, so the code probably doesn't run as-is).
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.