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

Starting zzzOpenOPCService error #5

Open
rehakmatej opened this issue May 3, 2018 · 15 comments
Open

Starting zzzOpenOPCService error #5

rehakmatej opened this issue May 3, 2018 · 15 comments

Comments

@rehakmatej
Copy link

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

@kenrena
Copy link

kenrena commented Jun 7, 2018

I came aross the same problem, any help?

@Ansonmo
Copy link

Ansonmo commented Jun 20, 2018

I got the same problem @window 2008 64bit system. i m using Python3.6 32bit and pyro4.7

@rehakmatej
Copy link
Author

Try to run python with admin privileges.

@Ansonmo
Copy link

Ansonmo commented Jun 21, 2018

Thanks for your reply,@rehakmatej, but it failed. it prompted" The service is not responding to the control funciton"

@Ansonmo
Copy link

Ansonmo commented Jun 21, 2018

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 anson6@163.com

@rehakmatej
Copy link
Author

Try to download OpenOPC from http://openopc.sourceforge.net/. There is OpenOPCService.exe file and small tutorial how to run it.

@Ansonmo
Copy link

Ansonmo commented Jun 21, 2018

@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.

@rehakmatej
Copy link
Author

You can try to debug OpenOPCService.py file. I am using Jetbrains PyCharm IDE in which you can debug python code.

@Ansonmo
Copy link

Ansonmo commented Jun 23, 2018

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.

@fmaill06
Copy link

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.

@Ansonmo
Copy link

Ansonmo commented Jul 12, 2018 via email

@joaoemilioml
Copy link

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):

  1. In the Lib\site-packages folder, copy the dlls from pywin32_system32 folder to win32 folder
  2. 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
  1. 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.

@ottowayi
Copy link

ottowayi commented Apr 14, 2021

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.

@Ericwonne
Copy link

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

@jamesbraza
Copy link

jamesbraza commented Jan 5, 2023

They way I got zzzOpenOPCService to run with a **32-bit** (important from #22 (comment)) Python 3.10 on Windows 10:

git clone git@github.com: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

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

8 participants