如何修复snap7中的模块错误

时间:2019-05-03 09:57:36

标签: python module snap7

我正在尝试在plc s7 1200rpi 3之间建立通信,我已经安装了snap7,但是在执行此代码时出现以下错误:

  

没有名为snap7的模块

这是我的代码:

from time import sleep
import snap7
from snap7.util import *
import struct

plc = snap7.client.Client()
plc.connect("192.168.12.73",0,1)

area = 0x82    # area for Q memory
start = 0      # location we are going to start the read
length = 1     # length in bytes of the read
bit = 0        # which bit in the Q memory byte we are reading

byte = plc.read_area(area,0,start,length)
print "Q0.0:",get_bool(mbyte,0,bit)
plc.disconnect()

0 个答案:

没有答案