openopc
openopc copied to clipboard
Starting zzzOpenOPCService error
Hello, I am trying to start zzzOpenOPCService by running OpenOPCService.py but I am still getting error "The service did not respond to the start or control request in a timely fashion". I am using Python 3.6.5 32-bit on Windows 10. Thank you for any advices
I came aross the same problem, any help?
I got the same problem @window 2008 64bit system. i m using Python3.6 32bit and pyro4.7
Try to run python with admin privileges.
Thanks for your reply,@rehakmatej, but it failed. it prompted" The service is not responding to the control funciton"
if anybody can package the one-file openopcservice.exe for me, I am also facing the problem to pack it by pyinstaller. Thanks in advance. my email is [email protected]
Try to download OpenOPC from http://openopc.sourceforge.net/. There is OpenOPCService.exe file and small tutorial how to run it.
@rehakmatej, thanks. But the one in the link was package by python2.x with pyro3, which is not compatible with this ya-mouse's one on pyro4.
You can try to debug OpenOPCService.py file. I am using Jetbrains PyCharm IDE in which you can debug python code.
Eventually, i found the issue. I used to debug in Pycharm virtualenv, and had multiple verison of Pyhton in OS. seems the module imported from Pycharm has some issue. The solution is to download the pywin32 and Pyro4 to real OS environment. and then works well.
Hello i got the same problem recently, the OpenOPCService seems to gets installed correctly : Installing service zzzOpenOPCService Service installed But when i try to start the service i get : "The service did not respond to the start or control request in a timely fashion" The thing is I get this error in 1 sec. Plus I am working in a virtual env. If anyone knows why i am really interested. Thank you in advance.
I have the same problem on pycharm and virtual env. I assumed the pywin32 and pyro was not correctly installed thru pycharm. as i used Python3.6 32bit. So after directly installed above lib via pip on the real env. It works well.
But it doesn't work when i compiled it to exe by pyInstaller. Good luck and pls let me know if you could complie it to a workable exe.
Br, Anson On 07/12/2018 16:22, fmaill06 wrote:
Hello i got the same problem recently, the OpenOPCService seems to gets installed correctly : Installing service zzzOpenOPCService Service installed But when i try to start the service i get : "The service did not respond to the start or control request in a timely fashion" The thing is I get this error in 1 sec. Plus I am working in a virtual env. If anyone knows why i am really interested. Thank you in advance.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
Hi,
Took me some time and a fair bit of digging in several forums to figure this all out. What worked for me (this is regarding any python service in general):
- In the Lib\site-packages folder, copy the dlls from pywin32_system32 folder to win32 folder
- Put python folders (dll, site-packages, scripts) in the SYSTEM Path. For Python 3.7 they are:
- C:\Users\username\AppData\Local\Programs\Python\Python37-32\DLLs
- C:\Users\username\AppData\Local\Programs\Python\Python37-32\Scripts\
- C:\Users\username\AppData\Local\Programs\Python\Python37-32\
- C:\Users\username\AppData\Roaming\Python\Python37\site-packages
- Add a SYSTEM variable called PYTHONPATH with the same folders you added in step 2
After these steps I was able to start any python service without getting any errors.
I was having trouble with this error also and nothing was working until I realized my Python install was a user install (default) and not system. Once I installed Python for all users I no longer had this problem.
Edit: I still had issues getting the service to run correctly, my solution was to use PyInstaller to bundle the service module into an exe and register that as a service. The pyinstaller command is:
pyinstaller --onefile --hidden-import=json --hidden-import=win32timezone OpenOPCService.py
Also FYI: Currently there is a bug in the service code that will cause it to not use the environment variable settings and always use the defaults. My pull request #19 will fix that issue.
As for me even if service zzzOpenOpcService is gracefully started, the client reading from a remote machine using open_client worked, but returned unexpected values, very much different from reading directly on the sim server using client, which did return the expected values, as shown on the sim server interface.
If anyone got any idea about this, it would be nice of you to open my mind to this.
Reproduction:
host, server = '10.10.10.10', 'opcserversim.Instance.1'
opc = OpenOPC.open_client(host)
opc.connect(opc_server=server)
opc.read('IntegerValue')
Some default tags like 'IntegerValue', even if it's changing, what client read does not change, some manually added tags like 'PLC1.gv_HighVoltageCMS.ind.HVMultiMetertActualFrequency_Hz' was never got read. i have no idea why
I learnt this code from here
They way I got zzzOpenOPCService
to run with a **32-bit** (important from https://github.com/ya-mouse/openopc/issues/22#issuecomment-1371526945) Python 3.10 on Windows 10:
git clone [email protected]:mkwiatkowski/openopc.git
cd openopc
python -m pip install -e . pyinstaller pywin32
pyinstaller --onefile --hidden-import=json --hidden-import=win32timezone ./src/OpenOPCService.py
./dist/OpenOPCService install
./dist/OpenOPCService start
And a special thank you to @ottowayi for being awesome and suggesting pyinstaller
above