开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: COM error trying to connect.


marinindextrader
 

In VB this (tws.connect('', 7496)) Would be:

tws.connect "",7496 [Double Quotes not single quotes]

Other than that don't know no pYthons

Scott




--- In twsapi@y..., "houdinihound" <houdinihound@y...> wrote:
Hi,

Was trying to connect via COM but keep getting this error:
com_error: (-2147418113, 'Unexpected failure', None, None)

I checked my system and the TWS ActiveX control is registered.
Also
the app is running (build 769.1) and logged in to EDEMO account.
It
is also set to accept connections.

I'm using Python to connect, code as follows:

tws = Dispatch("TWS.TwsCtrl.1")

which works and creates the object exposing all it's methods and
properties.

However, when I try to connect:

tws.connect('', 7496)

I get the error. I've tried specifying the IP address as well, no
difference.

Anyone done it this way or am I missing something obvious?

Thanks in advance for any advice.

JC

Join [email protected] to automatically receive all group messages.