AnsweredAssumed Answered

cannot connect to server with PIconnect Python library

Question asked by Punch872 on Apr 3, 2020

Hi, This is my first post since I've been using PIconnect API I've found some error that hardly finds the way to resolve this error every time I try to import the library


System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://User/AFServer/Service. The connection attempt lasted for a time span of 00:00:05.0040160. TCP error code 10061: No connection could be made because the target machine actively refused it <IP-address>.


  at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
   at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\PunchokK\.virtualenvs\pi-historical-data-Q5_65UCI\lib\site-packages\PIconnect\", line 61, in <module>
    class PIAFDatabase(object):
  File "C:\Users\PunchokK\.virtualenvs\pi-historical-data-Q5_65UCI\lib\site-packages\PIconnect\", line 71, in PIAFDatabase
    for s in AF.PISystems()
  File "C:\Users\PunchokK\.virtualenvs\pi-historical-data-Q5_65UCI\lib\site-packages\PIconnect\", line 71, in <dictcomp>
    for s in AF.PISystems()
  File "C:\Users\PunchokK\.virtualenvs\pi-historical-data-Q5_65UCI\lib\site-packages\PIconnect\", line 70, in <dictcomp>
    s.Name: {"server": s, "databases": {d.Name: d for d in s.Databases}}