Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am doing a project to implement Modbus client in the Python.

I found the package pymodbus. I installed in Windows it works fine , When I installed the package in raspberry Debian Linux, it was successful. I installed by using the following commands:

sudo easy_install pip
sudo pip install pymodbus

Pathbrowser is updated, show the path of the package in the dist-package.

But when I run the code, it gives me the error, My code is mentioned below.

from pymodbus.client.sync import ModbusTcpClient

# Accessing the ModBus Client with the IP address     
client = ModbusTcpClient('127.0.0.1')

# Function Code 05 (x05) Write single Output coil (Coil_number,Data(True/False),Slave_ID(hex))

client.write_coil(5, True,unit=0x02)

# Function Code 01 (x01) Read output coils and store in vector (Start_coil_no,count_coil,Slave_ID)

result = client.read_coils(1,10,unit=0x02)
print (result.bits[4])
share|improve this question
    
If you take a moment to read the instructions for formatting code sample, your question will be much easier for people to read. –  larsks Aug 12 at 14:08
2  
Where is the actual error message you get? –  John Aug 12 at 14:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.