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
#
当我运行代码时,会给我这个错误:“更改规范错误。不能包含尚未打开的文件。使用 p4 添加、p4 编辑等打开新文件。”
我试图用 p4.run("edit", file1) 打开文件,但是程序什么也不做,并且在此之后不运行下一个命令。如何打开文件以及 p4 add 和 p4 edit 的 python 工作命令是什么?