P4Python p4.temp_client broken?
P4Python p4.temp_client broken?
我似乎不能将临时客户端与p4python一起使用...
当我保存客户端时,我可以很好地同步。 前任。
from P4 import P4,P4Exception
p4 = P4()
p4.client = "example"
p4.port = "1666"
p4.user = "fooser"
client_root = '/foo/bar'
p4.connect()
client = p4.fetch_client()
client._root = client_root
p4.save_client(p4)
p4.run_sync('-f')
工作正常。我在我的仓库里拿到了文件。
但是,如果我将最后一行调整为临时客户端......
with p4.temp_client('temp',client) as t:
p4.run_sync()
我收到以下错误...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/Users/fooser/repos/foo/foo-env/lib/python3.7/site-packages/P4.py", line 868, in temp_client
ws = self.fetch_client('-t', template, name)
File "/Users/fooser/repos/foo/foo-env/lib/python3.7/site-packages/P4.py", line 503, in <lambda>
return lambda *args, **kargs: self.__fetch(cmd, *args, **kargs)
File "/Users/fooser/repos/foo/foo-env/lib/python3.7/site-packages/P4.py", line 538, in __fetch
result = self.run(cmd, "-o", *args, **kargs)
File "/Users/fooser/repos/foo/foo-env/lib/python3.7/site-packages/P4.py", line 611, in run
raise e
File "/Users/fooser/repos/foo/foo-env/lib/python3.7/site-packages/P4.py", line 605, in run
result = P4API.P4Adapter.run(self, *flatArgs)
P4.P4Exception: [P4#run] Errors during command execution( "p4 client -o -t {'Client': 'ansible', 'Update': '2018/09/20 05:58:44', 'Access': '2018/09/20 05:58:44', 'Owner': 'stobias', 'Host': 'toby-imac.local', 'Description': 'ignore', 'Root': '/Users/stobias/p4test', 'Options': 'noallwrite noclobber nocompress unlocked nomodtime normdir', 'SubmitOptions': 'submitunchanged', 'LineEnd': 'local', 'Type': 'writeable', 'Backup': 'enable', 'View': ['//depot/... //ansible/...']} temp_9c5db5fa-bc9a-11e8-a517-10ddb1a3f3f1" )
[Error]: "Wildcards (*, %%x, ...) not allowed in '{'Client':_'ansible',_'Update':_'2018/09/20_05:58:44',_'Access':_'2018/09/20_05:58:44',_'Owner':_'stobias',_'Host':_'toby-imac.local',_'Description':_'ignore',_'Root':_'/Users/stobias/p4test',_'Options':_'noallwrite_noclobber_nocompress_unlocked_nomodtime_normdir',_'SubmitOptions':_'submitunchanged',_'LineEnd':_'local',_'Type':_'writeable',_'Backup':_'enable',_'View':_['//depot/... //ansible/...']}'."
[P4#run] Errors during command execution( "p4 client -o -t {'Client': 'ansible', 'Update': '2018/09/20 05:58:44', 'Access': '2018/09/20 05:58:44', 'Owner': 'stobias', 'Host': 'toby-imac.local', 'Description': 'ignore', 'Root': '/Users/stobias/p4test', 'Options': 'noallwrite noclobber nocompress unlocked nomodtime normdir', 'SubmitOptions': 'submitunchanged', 'LineEnd': 'local', 'Type': 'writeable', 'Backup': 'enable', 'View': ['//depot/... //ansible/...']} temp_9c5db5fa-bc9a-11e8-a517-10ddb1a3f3f1" )
[Error]: "Wildcards (*, %%x, ...) not allowed in '{'Client':_'ansible',_'Update':_'2018/09/20_05:58:44',_'Access':_'2018/09/20_05:58:44',_'Owner':_'stobias',_'Host':_'toby-imac.local',_'Description':_'ignore',_'Root':_'/Users/stobias/p4test',_'Options':_'noallwrite_noclobber_nocompress_unlocked_nomodtime_normdir',_'SubmitOptions':_'submitunchanged',_'LineEnd':_'local',_'Type':_'writeable',_'Backup':_'enable',_'View':_['//depot/... //ansible/...']}'."
我试图深入研究源代码,但这个库似乎依赖于 c++ 模块,我在那里超出了我的深度。
P4python 源代码和示例 - https://swarm.workshop.perforce.com/view/guest/robert_cowham/perforce/API/python/index.html?v=9#downloads
查看错误,我可以看到它试图将 Python 字典的字符串表示作为"-t"标志传递给 p4 命令,这显然是错误的。 :)
从文档temp_client:
p4.temp_client( "<prefix>", "<template>" )
Creates a temporary client, using the prefix <prefix> and based upon a client template named <template>
第二个参数只是模板客户端的 NAME(作为字符串(,而不是整个规范(作为字典(。 这是将在实际 p4 命令中作为-t template
传递的内容。
尝试:
with p4.temp_client('temp', 'example') as t:
p4.run_sync()
相关文章:
- FindPOCO CMAKE 脚本无法找到 MYSQL::client
- P4Python p4.temp_client broken?
- boost beast Websocket Multi Request Server/Client 并不是真正的 mul
- 如何从字符串创建一个web::uri以放入client.connect()
- char,const char*阵列问题,用于mqtt client.publish
- socket.io client std :: bind-错误C2338:元组索引限制
- c中的neo4j-client,在语句中编码的原始类型(即int)
- ZeroMQ Hello World Client - Server.来自服务器的回复显然没有到达
- CPP中的BOOST.ASIO SERVER-CLIENT程序
- Boost asio library for networking (http client)
- Java Thrift Client and Binary data
- 为什么 bash 在进程死后不打印"Broken pipe"日志?
- is compare_exchange_weak for std::shared_ptr broken in msvs
- gSoap client side, LNK2019, Qt
- Ubuntu 16.04 LTS 和 Oracle Instant Client - C++链接错误
- SMTP c++ client
- Boost ASIO HTTP client POST
- Android NDK seekg broken?
- MongoDB C++ 驱动程序 - 错误:尚未声明"mongo::client"
- WSAGetLastError 10038 in a C++ client