Closed KAYAUgurBerat closed 2 years ago
Hello everyone, I want to change the values of the data blocks in the plc with the snap7 library. When I try this, I get the error shown below.
b'CPU : Item not available' Traceback (most recent call last): File "D:/Belgeler D/pythonProject/plcdeneme.py", line 10, in plc_info = plc.get_cpu_info() File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\snap7\client.py", line 161, in get_cpu_info check_error(result, context="client") File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\snap7\common.py", line 92, in check_error raise Snap7Exception(error) snap7.exceptions.Snap7Exception: b'CPU : Item not available'
Process finished with exit code 1
And this is my code:
import snap7 IP = "192.168.0.1" RACK = 0 SLOT = 1 plc = snap7.client.Client() plc.connect(IP,RACK,SLOT) plc_info = plc.get_cpu_info() print(f"adı: {plc_info.ModuleTypeName}") state = plc.get_cpu_state() print(f"State: {state}")
I made all the plc settings on Snap7's own site. What should I do to fix this problem? Thank you from n ow
Hello everyone, I want to change the values of the data blocks in the plc with the snap7 library. When I try this, I get the error shown below.
b'CPU : Item not available' Traceback (most recent call last): File "D:/Belgeler D/pythonProject/plcdeneme.py", line 10, in
plc_info = plc.get_cpu_info()
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\snap7\client.py", line 161, in get_cpu_info
check_error(result, context="client")
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\snap7\common.py", line 92, in check_error
raise Snap7Exception(error)
snap7.exceptions.Snap7Exception: b'CPU : Item not available'
Process finished with exit code 1
And this is my code:
I made all the plc settings on Snap7's own site. What should I do to fix this problem? Thank you from n ow