I'm trying to create a server program in python but when I run it I get this error:
C:\Users\dpedraza.VARIADORES\AppData\Local\Programs\Python\Python36-32\python.exe "C:/Users/dpedraza.VARIADORES/Desktop/Prueba Event/ventana.py"
Traceback (most recent call last):
File "C:/Users/dpedraza.VARIADORES/Desktop/Prueba Event/ventana.py", line 12, in <module>
from pymodbus.server.async import StartTcpServer
File "C:\Users\dpedraza.VARIADORES\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymodbus\server\async.py", line 9, in <module>
from twisted.internet import reactor
File "C:\Users\dpedraza.VARIADORES\AppData\Local\Programs\Python\Python36-32\lib\site-packages\twisted\internet\reactor.py", line 39, in <module>
default.install()
File "C:\Users\dpedraza.VARIADORES\AppData\Local\Programs\Python\Python36-32\lib\site-packages\twisted\internet\selectreactor.py", line 196, in install
reactor = SelectReactor()
File "C:\Users\dpedraza.VARIADORES\AppData\Local\Programs\Python\Python36-32\lib\site-packages\twisted\internet\selectreactor.py", line 72, in __init__
posixbase.PosixReactorBase.__init__(self)
File "C:\Users\dpedraza.VARIADORES\AppData\Local\Programs\Python\Python36-32\lib\site-packages\twisted\internet\base.py", line 515, in __init__
self.installWaker()
File "C:\Users\dpedraza.VARIADORES\AppData\Local\Programs\Python\Python36-32\lib\site-packages\twisted\internet\posixbase.py", line 284, in installWaker
self.waker = self._wakerFactory(self)
File "C:\Users\dpedraza.VARIADORES\AppData\Local\Programs\Python\Python36-32\lib\site-packages\twisted\internet\posixbase.py", line 79, in __init__
client.connect(server.getsockname())
TimeoutError: [WinError 10060] Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder
In fact I have performed this test on another PC and it works without problems. I have already disabled the firewall, the antivirus and I have verified the Ethernet configuration but nothing happens. The code is as follows:
#!/usr/bin/env python
"""
Pymodbus Asynchronous Server Example
--------------------------------------------------------------------------
The asynchronous server is a high performance implementation using the
twisted library as its backend. This allows it to scale to many thousands
of nodes which can be helpful for testing monitoring software.
"""
# --------------------------------------------------------------------------- #
# import the various server implementations
# --------------------------------------------------------------------------- #
from pymodbus.server.async import StartTcpServer
from pymodbus.server.async import StartUdpServer
from pymodbus.server.async import StartSerialServer
from pymodbus.device import ModbusDeviceIdentification
from pymodbus.datastore import ModbusSequentialDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
from pymodbus.transaction import ModbusRtuFramer, ModbusAsciiFramer
# --------------------------------------------------------------------------- #
# configure the service logging
# --------------------------------------------------------------------------- #
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)
def run_async_server():
print('nada')
#perro = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
store = ModbusSlaveContext(
di=ModbusSequentialDataBlock(0, [17] * 100),
co=ModbusSequentialDataBlock(0, [17] * 100),
hr=ModbusSequentialDataBlock(0, [17] * 100),
ir=ModbusSequentialDataBlock(0, [17] * 100))
context = ModbusServerContext(slaves=store, single=True)
identity = ModbusDeviceIdentification()
identity.VendorName = 'Pymodbus'
identity.ProductCode = 'PM'
identity.VendorUrl = 'http://github.com/bashwork/pymodbus/'
identity.ProductName = 'Pymodbus Server'
identity.ModelName = 'Pymodbus Server'
identity.MajorMinorRevision = '1.0'
StartTcpServer(context, identity=identity, address=("10.10.14.102", 502))
if __name__ == "__main__":
run_async_server()
Any help you can give me would be excellent, thank you very much.