Hey guys, I am pretty new to p4 scripting but feel like I see more python p4 scripts written using subprocess and p4 commands rather than the P4 API. Is there a reason for this? As I write this I realized that the p4 commandline interface is installed with p4 which saves a step. Are there any other reasons to use subprocess instead of the API? Thanks!
a big one that comes to mind is in Maya, it needs to be recompiled with vs 2010 and against a specific python version. So just maintenance and only using the standard lib.
Other than Maya and other environments where P4Python is unavailable, I don’t know why you would choose the command-line approach. The Perforce API is easy to use and does everything.
You can do p4python in Maya, you jiust need to find the right version of the .pyd file and get it into your pythonPath.
That said ‘easy to use’ may be true but ‘easy to work with’ is a little optimistic It’s not a lot of typing but p4 has a genius for the Principle of Most Surprise in API design.