Reputation: 1
try: # Catch exceptions with try/except
p4.connect() # Connect to the Perforce Server
p4.run_login()
client = p4.fetch_client()
client['View'] = ['//TestPublic/Extern/firanl/... //mitica/TestPublic/Extern/firanl/...'] # workspace mapping
p4.save_client(client)
# p4.run_sync() # this command stops the execution of other commands after this
result = p4.run("fstat", perforce_path)[0]
file1 = result['clientFile']
change = p4.fetch_change()
change._files = [file1] #associate file to changelist
change._description = 'aaaaaa'
p4.run_submit(change)
p4.disconnect() # Disconnect from the Server
except P4Exception:
for e in p4.errors: # Display errors
print e
#
When I run the code, will give me this error: "Error in change specification. Can't include file(s) not already opened. Open new files with p4 add, p4 edit, etc."
I tried to open the file with p4.run("edit", file1), but the program does nothing and doesn't run the next commands after this. How do I open the file and what are the python working commands for p4 add and p4 edit?
Upvotes: 0
Views: 1634
Reputation: 3249
Focus on your run_sync
command. My guess is that it's not using the client you've just set up.
To verify what is getting used, run run_set
and print its results.
To make sure you're using your client, first give it a name (using client['Name'] = 'MyClient'
) before saving it and then tell your P4Python to use it (p4.client = 'MyClient'
).
Then run your sync.
Upvotes: 1