i started running this code python but give me errors
code python:
import snap7
import struct
import time
from snap7.snap7exceptions import Snap7Exception
import re
from ctypes import c_int, c_char_p, byref, sizeof, c_uint16, c_int32, c_byte
from ctypes import c_void_p
from time import sleep
import snap7.client as c
plc = snap7.client.Client()
plc.connect ('192.168.0.1',0,1,tcpport=135)
plc.writeMem('QX0.0',True) # write Q0.0 to be true, which will only turn on the output if it isn't connected to any rung in your ladder code
print plc.getMem('MX0.1') # read memory bit M0.1
print plc.getMem('IX0.0') # read input bit I0.0
plc.plc.disconnect()
////
errors:
C:\Python27\python.exe C:/Users/simo/PycharmProjects/untitled2/SNAPP.py
No handlers could be found for logger "snap7.common"
Traceback (most recent call last):
File "C:/Users/simo/PycharmProjects/untitled2/SNAPP.py", line 13, in <module>
plc.connect ('192.168.0.1',0,1,tcpport=135)
File "C:\Python27\lib\site-packages\snap7\client.py", line 25, in f
check_error(code, context="client")
File "C:\Python27\lib\site-packages\snap7\common.py", line 65, in check_error
raise Snap7Exception(error)
snap7.snap7exceptions.Snap7Exception: ISO : An error occurred during recv TCP : Connection timed out
any ideas??
code python:
import snap7
import struct
import time
from snap7.snap7exceptions import Snap7Exception
import re
from ctypes import c_int, c_char_p, byref, sizeof, c_uint16, c_int32, c_byte
from ctypes import c_void_p
from time import sleep
import snap7.client as c
plc = snap7.client.Client()
plc.connect ('192.168.0.1',0,1,tcpport=135)
plc.writeMem('QX0.0',True) # write Q0.0 to be true, which will only turn on the output if it isn't connected to any rung in your ladder code
print plc.getMem('MX0.1') # read memory bit M0.1
print plc.getMem('IX0.0') # read input bit I0.0
plc.plc.disconnect()
////
errors:
C:\Python27\python.exe C:/Users/simo/PycharmProjects/untitled2/SNAPP.py
No handlers could be found for logger "snap7.common"
Traceback (most recent call last):
File "C:/Users/simo/PycharmProjects/untitled2/SNAPP.py", line 13, in <module>
plc.connect ('192.168.0.1',0,1,tcpport=135)
File "C:\Python27\lib\site-packages\snap7\client.py", line 25, in f
check_error(code, context="client")
File "C:\Python27\lib\site-packages\snap7\common.py", line 65, in check_error
raise Snap7Exception(error)
snap7.snap7exceptions.Snap7Exception: ISO : An error occurred during recv TCP : Connection timed out
any ideas??