Using P4Python, how can I use environment variables to access different clients across different computers/workspaces?

1k Views Asked by At

I'm working with Perforce and have a script to check out various files depending on my current task. The issue is that I'd like to store environment variables for the port, user and client so that I don't have to change my script each time it is run from a different computer.

For accessing Perforce, I've set up as the example posted below and tried to change the client using the formula "p4 set P4CLIENT=value" in CMD where "value" is what "p4.client" would be assigned to in the Python script. I'm unsure if this is how to go about it and would appreciate any help.

--Example--

from P4 import P4,P4Exception    # Import the module
p4 = P4()                        # Create the P4 instance
p4.port = "1666"
p4.user = "fred"
p4.client = "fred-ws"            # Set some environment variables
0

There are 0 best solutions below