简体   繁体   中英

Cannot connect to a ssl-enabled perforce server using p4python

Python version: 2.7.8 P4Python version: P4PYTHON/NTX86/2014.1/807760 (2014.1/807760 API) (2014/03/18) Client OS: Win2k8 Server

Python script:

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()

Output:

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() output:

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).

The path to OpenSSL (lib) is set in the Path variable.

I also checked 'p4 set' on the client machine (from where I am trying to connect to the perforce server) and I see that all environment variables are properly set.

Can someone please let me know how to resolve this?

I believe the problem is that you are linking with the wrong Openssl library. The output of P4.identify() is misleading: this is the version of the OpenSSL the API was compiled with, not the version you are linking against.

Where did you get that version of P4Python from? Did you compile it yourself or did you download it from some other site?

If you want to use a ready-made version of P4Python for Windows Python 2.7 and 3.4 32bit and 64bit, please have a look at https://swarm.workshop.perforce.com/projects/p4pythonlib/files/p4pythonlib/bin . Let me know if you have any problems with these builds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM