Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent read error occurs. Help solve the problem #27

Open
DanilaX1 opened this issue Jan 19, 2023 · 5 comments
Open

Intermittent read error occurs. Help solve the problem #27

DanilaX1 opened this issue Jan 19, 2023 · 5 comments

Comments

@DanilaX1
Copy link

Intermittent read error occurs. Help solve the problem

2023-01-18 00:00:35,292 ERROR Connect: -2146959355
Traceback (most recent call last):
File "C:\Users\Freelancer\PycharmProjects\OPC_DATA\venv\lib\site-packages\OpenOPC.py", line 223, in connect
self._opc.Connect(s, opc_host)
File "C:\Users\FREELA~1\AppData\Local\Temp\gen_py\3.8\341A7851-5DEA-4022-B0D6-F9954AF9273Dx0x1x0.py", line 233, in Connect
return self.oleobj.InvokeTypes(1610743826, LCID, 1, (24, 0), ((8, 1), (12, 17)),ProgID
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146959355), None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Freelancer\PycharmProjects\OPC_DATA\WRdbSchedule.py", line 68, in RdAndWrOPCtoDB
maplai.rdtagfor_db()
File "C:\Users\Freelancer\PycharmProjects\OPC_DATA\WRdbSchedule.py", line 36, in rdtagfor_db
opc.connect('Freelance2000OPCServer.51')
File "C:\Users\Freelancer\PycharmProjects\OPC_DATA\venv\lib\site-packages\OpenOPC.py", line 227, in connect
raise OPCError(error_msg)
OpenOPC.OPCError: Connect: -2146959355

I made a script to write data to a database. Reading and writing occurs once every 5 seconds. Unfortunately, this script does not work stably for 1 or 5 days, then such an error occurs. Help find a solution

@ya-mouse
Copy link
Owner

The returned error is 0x80080005 (returned by DCOM on the target system). Is the error occurs on the same requests as when it runs fine or accessing different objects? This also might mean wrong CLSID, not sufficient rights and so on. You should check the windows event log on the server. If the Freelance2000OPCServer have own logs, check it also.

@ya-mouse
Copy link
Owner

The error 0x80020009 means invalid value.

@ya-mouse
Copy link
Owner

In common sense, it's better to catch exceptions, log failed attempt and retry.

@DanilaX1
Copy link
Author

DanilaX1 commented Feb 10, 2023

I made some changes and now I'm getting the error about once a week -2147024732
windows event log constantly issues
"C:\Program Files (x86)\ABB\Freelance\exe\opcsrv.exe" -51 -Embedding
IOPCItemMgt::RemoveItems(): failed because group 'Come' is marked as deleted, return E_FAIL
please tell me which direction to go

@DanilaX1
Copy link
Author

DanilaX1 commented Feb 14, 2023

For a better understanding of the problem, I will give the code of the function. In it I use the read function opc.iread(self.tags)
could that be the problem. I don't use 'Come' groups

 def rdtagfor_db(self):
        try:
            self.data = []
            for name, value, quality, time in opc.iread(self.tags):
                if quality == 'Good':
                    self.data.append(value)  # Для консистенции данные записываются в любом случае
                else:
                    self.data.append(0.0)
                    print(name, "is not good")
                    logging.error((name + "is not good"), exc_info=True)  # Но если ОПЦ возвращает не ГУд то пишем в лог
        except OpenOPC.TimeoutError:
            print("TimeoutError occured")
            logging.error(("TimeoutError occured"), exc_info=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants