Alexhll / OpenOPC-python3.6

OpenOPC for python3.6 enviroment
Other
34 stars 21 forks source link

Got exception when using openOPC in python3.6,win10 x64 #1

Open heroxxCN opened 5 years ago

heroxxCN commented 5 years ago

opc = OpenOPC.client() Traceback (most recent call last): File "C:\Python36\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch IDispatch = pythoncom.connect(IDispatch) pywintypes.com_error: (-2147221021, '操作无法使用', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Python36\lib\site-packages\OpenOPC.py", line 167, in init self._opc = win32com.client.gencache.EnsureDispatch(c, 0) File "C:\Python36\lib\site-packages\win32com\client\gencache.py", line 527, in EnsureDispatch disp = win32com.client.Dispatch(prog_id) File "C:\Python36\lib\site-packages\win32com\client__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python36\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python36\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) pywintypes.com_error: (-2147221164, '没有注册类', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\Python36\lib\site-packages\OpenOPC.py", line 173, in init raise OPCError(error_msg) OpenOPC.OPCError: Dispatch: 没有注册类

IMartin666 commented 5 years ago

I think you dont achieve the step 5 in https://github.com/Alexhll/OpenOPC-python3.6 ### C:\OpenOPC36\lib\regsvr32 gbda_aut.dll### try it again and open the cmd with Administrator status

ydwpython commented 5 years ago

我认为你没有实现https://github.com/Alexhll/OpenOPC-python3.6 ### C:\ OpenOPC36 \ lib \ regsvr32 gbda_aut.dll ###中的第5步再次尝试并使用Administrator打开cmd 状态

你好,,你是北京的吗,能联系到你吗

heroxxCN commented 5 years ago

I think you dont achieve the step 5 in https://github.com/Alexhll/OpenOPC-python3.6 ### C:\OpenOPC36\lib\regsvr32 gbda_aut.dll### try it again and open the cmd with Administrator status

I've did it exactly as step 5,but it did not work on win10x64。 I've got it worked well on win7 x32.

2makeitwork commented 5 years ago

Please be aware the gbda_aut.ll has a 32bit and 64bit version. I can happen you didn't register the right 'bit' version. However, I never made it working under Win10 64bit but for a different reason. I use the 'open' mode and can use the .server(), .list() from a remote Linux without any issue. But once I use the .read('variable') function, the zzzOpenOPCService automatically 'stops' and I receive a connectionClosedError from Pyro4.

However, I use the same configuration on a Windows 7 74bit in open mode without any issue. I also found the client and server side must be the same 'bit'ness, although I only tested on 64bit.

To sum up, what works is: OPC Server side: Win7 64bit, Python 3.7.2 64bit Client side: Ubuntu Stretch 64bit, Python 3.5.3 64bit

2makeitwork commented 5 years ago

update: After I restarted win10, the openOPCGatewayService cannot be started, after you click start, it immediately stopped with a pop up message: the OpenOPC Gateway Service service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.