无法使用p4python连接到启用了ssl的perforce服务器

时间:2014-11-28 14:13:09

标签: python python-2.7 openssl perforce p4python

Python版本:2.7.8 P4Python版本:P4PYTHON / NTX86 / 2014.1 / 807760(2014.1 / 807760 API)(2014/03/18) 客户端操作系统:Win2k8服务器

Python脚本:

from P4 import P4, P4Exception
p4agent = P4()
p4agent.port = "ssl:my-perforce-server.com:1666"
p4agent.user = "abc"
p4agent.password = "a$3"
p4agent.connect()
p4agent.run_login()

输出:

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\PythonSync\P4Sync.py", line 44, in <module>
    getLatestRevision()
  File "C:\Users\Administrator\Desktop\PythonSync\P4Sync.py", line 41, in getLatestRevision
    initP4()
  File "C:\Users\Administrator\Desktop\PythonSync\P4Sync.py", line 36, in initP4
    p4agent.connect()
  File "c:\python27\lib\site-packages\P4.py", line 678, in connect
    P4API.P4Adapter.connect( self )
P4Exception: [P4.connect()] Connect to server failed; check $P4PORT.
SSL library must be at least version 1.0.1.

p4agent.identify()输出:

Perforce - The Fast Software Configuration Management System.
Copyright 1995-2014 Perforce Software.  All rights reserved.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)
See 'p4 help legal' for full OpenSSL license information
Version of OpenSSL Libraries: OpenSSL 1.0.1d 5 Feb 2013
Rev. P4PYTHON/NTX86/2014.1/807760 (2014.1/807760 API) (2014/03/18).

OpenSSL(lib)的路径在Path变量中设置。

我还检查了客户端计算机上的'p4 set'(从我尝试连接到perforce服务器的位置),我看到所有环境变量都已正确设置。

有人可以告诉我如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我认为问题在于您正在使用错误的Openssl库进行链接。 P4.identify()的输出具有误导性:这是编译API的OpenSSL的版本,而不是您链接的版本。

你从哪里获得P4Python的版本?您是自己编译还是从其他网站下载?

如果您想使用现成版本的P4Python for Windows Python 2.7和3.4 32bit和64bit,请查看https://swarm.workshop.perforce.com/projects/p4pythonlib/files/p4pythonlib/bin。如果您对这些版本有任何问题,请告诉我。