Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Replacing values ​​in Mysql with a condition
Post: Replacing values ​​in Mysql with a condition

Good evening everyone. Help in python to create a query in the Mysql database. Problem essence: There is a table, in it columns (Sil1 | Sil2 | Sil3) the data in a format -37.4 | -98.0 | -25.2. I need ...
stsxbel General Coding Help 0 642 Mar-05-2023, 08:20 PM
    Thread: Problem with pymodbus - ModuleNotFoundError: No module named 'pymodbus.client.sync'
Post: Problem with pymodbus - ModuleNotFoundError: No mo...

Good afternoon. I installed a new server, installed pymodbus via pip, uploaded my scripts that worked on the old server, but when I start it, I get an error: ModuleNotFoundError: No module named 'pymo...
stsxbel General Coding Help 2 23,819 Dec-05-2022, 02:08 PM
    Thread: Pymysql delete specific rows in tableview
Post: Pymysql delete specific rows in tableview

There is a database, data is constantly written to it, but sometimes data 0.0 gets. An entry appears in the table with values, for example prod1=0.0/ prod2=0.0/ prod3=0.0. And there can be a lot of su...
stsxbel General Coding Help 2 1,095 Aug-18-2022, 08:15 AM
    Thread: KeyError: 2
Post: RE: KeyError: 2

oops. Thank you. Everything is working :-)
stsxbel General Coding Help 8 1,735 Aug-16-2022, 06:29 PM
    Thread: KeyError: 2
Post: RE: KeyError: 2

Thanks, figured it out. You need to use row["product1"]. But the problem remained in another :-( everything works as it should, only the result is not written to the database for some reason :-( [15...
stsxbel General Coding Help 8 1,735 Aug-16-2022, 06:05 PM
    Thread: KeyError: 2
Post: RE: KeyError: 2

(Aug-16-2022, 05:48 PM)deanhystad Wrote: According to your print row is a dictioany, not a list. You can use row["id"] or row["date"] or row["product1"]. You cannot do row[2] or row[3]. Maybe tha...
stsxbel General Coding Help 8 1,735 Aug-16-2022, 05:55 PM
    Thread: KeyError: 2
Post: RE: KeyError: 2

(Aug-16-2022, 05:17 PM)ibreeden Wrote: Apparently "row" does not contain what you expect. So in such cases always add a print statement just before the line where the error occurs. print(row)What d...
stsxbel General Coding Help 8 1,735 Aug-16-2022, 05:34 PM
    Thread: KeyError: 2
Post: KeyError: 2

Good evening, the second day I struggle with the code, then there is no entry in the database, then the error is KeyError: 2 import struct import sys import time import datetime import pymysql.cursor...
stsxbel General Coding Help 8 1,735 Aug-16-2022, 04:15 PM
    Thread: Pymodbus Write value to register
Post: RE: Pymodbus Write value to register

Thanks a lot, got it. :-) I forgot to write one more parameter to another register
stsxbel General Coding Help 10 8,218 Aug-15-2022, 11:46 AM
    Thread: Pymodbus Write value to register
Post: RE: Pymodbus Write value to register

Can't even write the value to the register. from pymodbus.client.sync import ModbusSerialClient from pymodbus.exceptions import ModbusIOException unit = 1 client = ModbusSerialClient(method='rtu',...
stsxbel General Coding Help 10 8,218 Aug-12-2022, 12:56 PM
    Thread: Pymodbus Write value to register
Post: RE: Pymodbus Write value to register

I tried everything. In the documentation, I found a method for connecting RTU. the registers are still shifted by 1, i.e. instead of 40006 it will be 40005. But the error still pops up: Quote:Values:...
stsxbel General Coding Help 10 8,218 Aug-12-2022, 07:39 AM
    Thread: Pymodbus Write value to register
Post: RE: Pymodbus Write value to register

From the device description
stsxbel General Coding Help 10 8,218 Aug-10-2022, 12:06 PM
    Thread: Pymodbus Write value to register
Post: RE: Pymodbus Write value to register

Here's what happens. continuously Quote:Values: Exception Response(132, 4, IllegalFunction) Object Type: <class 'pymodbus.pdu.ExceptionResponse'> ['ExceptionOffset', '__class__', '__delattr__', ...
stsxbel General Coding Help 10 8,218 Aug-10-2022, 11:49 AM
    Thread: Pymodbus Write value to register
Post: RE: Pymodbus Write value to register

An error is thrown Quote:Values: Exception Response(132, 4, IllegalFunction) Traceback (most recent call last): File "/home/pokip/winox1.py", line 28, in <module> if values[0] == 0xFFFF: T...
stsxbel General Coding Help 10 8,218 Aug-10-2022, 11:17 AM
    Thread: Pymodbus Write value to register
Post: Pymodbus Write value to register

Good afternoon. Only on your forum lately I can find answers to my questions. Tell me, send new devices, I can’t extract data from them using Python. I can't figure out how to send the value to the re...
stsxbel General Coding Help 10 8,218 Aug-10-2022, 08:31 AM
    Thread: Repeat request by else
Post: RE: Repeat request by else

(Jul-28-2022, 05:49 PM)deanhystad Wrote: You need a loop to repeat sending the request until the responses match. I do not know enough about your process to know what code belongs inside the loop ...
stsxbel General Coding Help 2 1,185 Jul-30-2022, 03:34 PM
    Thread: Repeat request by else
Post: Repeat request by else

Good afternoon, there is a code that removes parameters, the request is made 2 times and if the answers match, the data is written to the database. I did not have any problems with this, if the data i...
stsxbel General Coding Help 2 1,185 Jul-28-2022, 04:37 PM
    Thread: On error - go to the next task
Post: RE: On error - go to the next task

Thank you. The simplest and most important working solution. **biggrin**
stsxbel General Coding Help 2 1,577 Jul-12-2021, 10:15 PM
    Thread: On error - go to the next task
Post: On error - go to the next task

There is a code that interrogates the device via modbus, in the code several devices are interrogated. When the device is turned off, there is no data, therefore an error is obtained and the program i...
stsxbel General Coding Help 2 1,577 Jul-12-2021, 09:04 PM
    Thread: Conditional evaluation
Post: RE: Conditional evaluation

It worked in this version: a1 = float(140.2) b1 = float(6543.5) silos1a = b1 - a1 if silos1a > 0: print(f'Расход: {silos1a:.1f}') else: silos1a = b1 - 6553.5 - a1 print(f'Расход: {si...
stsxbel General Coding Help 7 3,524 Jun-13-2021, 06:56 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020