Connection to the other side was lost in a non-clean fashion: Connection lost

Created at 18 Dec 2023, 18: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!
ID

idekel.santana

Joined 18.12.2023

Connection to the other side was lost in a non-clean fashion: Connection lost
18 Dec 2023, 18:42


Hi,
I am getting the error below when I try to open a connection using the example found at the readme file of this repo.

Python 3.11.5
Mac OS

I also tried with Python 3.9 and got the same error.

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/twisted/python/log.py", line 96, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python3.11/site-packages/twisted/python/log.py", line 80, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python3.11/site-packages/twisted/python/context.py", line 117, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.11/site-packages/twisted/python/context.py", line 82, in callWithContext
return func(*args, **kw)
--- ---
File "/usr/local/lib/python3.11/site-packages/twisted/internet/selectreactor.py", line 148, in _doReadOrWrite
why = getattr(selectable, method)()
File "/usr/local/lib/python3.11/site-packages/twisted/internet/tcp.py", line 615, in doConnect
self._connectDone()
File "/usr/local/lib/python3.11/site-packages/twisted/internet/tcp.py", line 643, in _connectDone
self.protocol.makeConnection(self)
File "/usr/local/lib/python3.11/site-packages/twisted/protocols/tls.py", line 226, in makeConnection
ProtocolWrapper.makeConnection(self, transport)
File "/usr/local/lib/python3.11/site-packages/twisted/protocols/policies.py", line 75, in makeConnection
self.wrappedProtocol.makeConnection(self)
File "/usr/local/lib/python3.11/site-packages/twisted/internet/protocol.py", line 509, in makeConnection
self.connectionMade()
File "/usr/local/lib/python3.11/site-packages/twisted/internet/endpoints.py", line 144, in connectionMade
self._wrappedProtocol.makeConnection(self.transport)
File "/usr/local/lib/python3.11/site-packages/twisted/internet/protocol.py", line 509, in makeConnection
self.connectionMade()
File "/Users/idekel/test_projects/OpenApiPy/ctrader_open_api/tcpProtocol.py", line 21, in connectionMade
self.factory.connected(self)
File "/Users/idekel/test_projects/OpenApiPy/ctrader_open_api/factory.py", line 11, in connected
self.client._connected(protocol)
File "/Users/idekel/test_projects/OpenApiPy/ctrader_open_api/client.py", line 32, in _connected
self._connectedCallback(self)
File "/Users/idekel/test_projects/OpenApiPy/main.py", line 26, in connected
deferred.addErrback(onError)
builtins.NameError: name 'deferred' is not defined

Disconnected: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionLost'>: Connection to the other side was lost in a non-clean fashion: Connection lost.
]
Unhandled Error
Traceback (most recent call last):
File "/Users/idekel/test_projects/OpenApiPy/main.py", line 41, in
reactor.run()
File "/usr/local/lib/python3.11/site-packages/twisted/internet/base.py", line 695, in run
self.mainLoop()
File "/usr/local/lib/python3.11/site-packages/twisted/internet/base.py", line 708, in mainLoop
self.doIteration(t)
File "/usr/local/lib/python3.11/site-packages/twisted/internet/selectreactor.py", line 142, in doSelect
_logrun(selectable, _drdw, selectable, method)
--- ---
File "/usr/local/lib/python3.11/site-packages/twisted/python/log.py", line 96, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python3.11/site-packages/twisted/python/log.py", line 80, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python3.11/site-packages/twisted/python/context.py", line 117, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.11/site-packages/twisted/python/context.py", line 82, in callWithContext
return func(*args, **kw)
File "/usr/local/lib/python3.11/site-packages/twisted/internet/selectreactor.py", line 153, in _doReadOrWrite
self._disconnectSelectable(selectable, why, method == "doRead")
File "/usr/local/lib/python3.11/site-packages/twisted/internet/posixbase.py", line 113, in _disconnectSelectable
selectable.connectionLost(failure.Failure(why))
File "/usr/local/lib/python3.11/site-packages/twisted/internet/tcp.py", line 508, in connectionLost
self._commonConnection.connectionLost(self, reason)
File "/usr/local/lib/python3.11/site-packages/twisted/internet/tcp.py", line 326, in connectionLost
protocol.connectionLost(reason)
File "/usr/local/lib/python3.11/site-packages/twisted/protocols/tls.py", line 409, in connectionLost
ProtocolWrapper.connectionLost(self, reason)
File "/usr/local/lib/python3.11/site-packages/twisted/protocols/policies.py", line 114, in connectionLost
self.wrappedProtocol.connectionLost(reason)
File "/usr/local/lib/python3.11/site-packages/twisted/internet/endpoints.py", line 163, in connectionLost
return self._wrappedProtocol.connectionLost(reason)
File "/usr/local/lib/python3.11/site-packages/twisted/application/internet.py", line 465, in connectionLost
self._lostNotification(reason)
File "/usr/local/lib/python3.11/site-packages/twisted/application/internet.py", line 658, in
self._factory, lambda _: self._clientDisconnected()
File "/usr/local/lib/python3.11/site-packages/automat/_methodical.py", line 235, in _clientDisconnected
(outputs, outTracer) = transitioner.transition(self)
File "/usr/local/lib/python3.11/site-packages/automat/_core.py", line 157, in transition
outState, outputSymbols = self._automaton.outputForInput(self._state,
File "/usr/local/lib/python3.11/site-packages/automat/_core.py", line 137, in outputForInput
raise NoTransition(state=inState, symbol=inputSymbol)
automat._core.NoTransition: no transition for MethodicalInput(method=<function _ClientMachine._clientDisconnected at 0x10efe6ca0>) in MethodicalState(method=<function _ClientMachine._connecting at 0x10efe5ee0>)

@idekel.santana