name 'CertificateOptions' is not defined

Created at 27 Mar 2022, 12:42
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
KY

kyosuke

Joined 17.03.2022

name 'CertificateOptions' is not defined
27 Mar 2022, 12:42


Hi, I'm testing the sample script from this page but I get the following error:

Traceback (most recent call last):
  File "c:\Users\Python\OpenApiPy\app.py", line 44, in <module>
    client = Client(EndPoints.PROTOBUF_LIVE_HOST if hostType.lower() == "live" else EndPoints.PROTOBUF_DEMO_HOST, EndPoints.PROTOBUF_PORT, TcpProtocol)
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\ctrader_open_api\client.py", line 13, in __init__
    endpoint = clientFromString(self._runningReactor, f"ssl:{host}:{port}")
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\twisted\internet\endpoints.py", line 2116, in clientFromString
    kwargs = _clientParsers[name](*args, **kwargs)
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\twisted\internet\endpoints.py", line 2000, in _parseClientSSL
    return _parseClientSSLOptions(kwargs)
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\twisted\internet\endpoints.py", line 1965, in _parseClientSSLOptions    
    configuration = CertificateOptions(
NameError: name 'CertificateOptions' is not defined. Did you mean: 'certificateOpenSSL'?

how can I fix it?


@kyosuke
Replies

amusleh
28 Mar 2022, 09:29 ( Updated at: 29 Mar 2022, 14:24 )

Hi,

We got this error report on Github issues too, we tested the package on Windows and Ubuntu and it works fine.

This issue is not related to OpenApiPy, it's related to Twisted.

Related Github issue: Cannot start ConsoleSample · Issue #10 · spotware/OpenApiPy (github.com)


@amusleh

robson_T
29 Mar 2022, 14:09

RE:

amusleh said:

Hi,

We got his error report on Github issues too, we tested the package on Windows and Ubuntu and it works fine.

This issue is not related to OpenApiPy, it's related to Twisted.

Related Github issue: Cannot start ConsoleSample · Issue #10 · spotware/OpenApiPy (github.com)

Very good, fine, super... only this part on Github not helpful at all. So far I can't use this tool either. You just write: It works for me, I don't know what you mean, I'm closing. I don't know, but it seems to me that it would be more important to fix it instead of ignoring it.


@robson_T

amusleh
29 Mar 2022, 14:22

RE: RE:

robson_T said:

amusleh said:

Hi,

We got his error report on Github issues too, we tested the package on Windows and Ubuntu and it works fine.

This issue is not related to OpenApiPy, it's related to Twisted.

Related Github issue: Cannot start ConsoleSample · Issue #10 · spotware/OpenApiPy (github.com)

Very good, fine, super... only this part on Github not helpful at all. So far I can't use this tool either. You just write: It works for me, I don't know what you mean, I'm closing. I don't know, but it seems to me that it would be more important to fix it instead of ignoring it.

Hi,

As it's not related to OpenApiPy we can't fix it, the exception is thrown by Twisted.

Which OS you are using?


@amusleh

amusleh
30 Mar 2022, 09:00

RE: RE:

robson_T said:

amusleh said:

Hi,

We got his error report on Github issues too, we tested the package on Windows and Ubuntu and it works fine.

This issue is not related to OpenApiPy, it's related to Twisted.

Related Github issue: Cannot start ConsoleSample · Issue #10 · spotware/OpenApiPy (github.com)

Very good, fine, super... only this part on Github not helpful at all. So far I can't use this tool either. You just write: It works for me, I don't know what you mean, I'm closing. I don't know, but it seems to me that it would be more important to fix it instead of ignoring it.

Hi,

Please check the Gihub issue, the user who opened the issue found a solution for this issue.


@amusleh

gerald.hoxha94
02 Oct 2022, 16:56

RE:

kyosuke said:

Hi, I'm testing the sample script from this page but I get the following error:

Traceback (most recent call last):
  File "c:\Users\Python\OpenApiPy\app.py", line 44, in <module>
    client = Client(EndPoints.PROTOBUF_LIVE_HOST if hostType.lower() == "live" else EndPoints.PROTOBUF_DEMO_HOST, EndPoints.PROTOBUF_PORT, TcpProtocol)
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\ctrader_open_api\client.py", line 13, in __init__
    endpoint = clientFromString(self._runningReactor, f"ssl:{host}:{port}")
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\twisted\internet\endpoints.py", line 2116, in clientFromString
    kwargs = _clientParsers[name](*args, **kwargs)
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\twisted\internet\endpoints.py", line 2000, in _parseClientSSL
    return _parseClientSSLOptions(kwargs)
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\site-packages\twisted\internet\endpoints.py", line 1965, in _parseClientSSLOptions    
    configuration = CertificateOptions(
NameError: name 'CertificateOptions' is not defined. Did you mean: 'certificateOpenSSL'?

how can I fix it?

 

You're missing OpenSSL, 

install it with `` pip3 install pyOpenSSL ``

Tested on Ubuntu 22.04


@gerald.hoxha94