iterativ / openopc2

🔥 OPC DA Python Library with awesome CLI
Other
92 stars 12 forks source link

Bug: fixing ability to run Gateway Service #42

Closed jamesbraza closed 1 year ago

jamesbraza commented 1 year ago

The OpenOPC Gateway section of the current README.md says:

C:\openopc2\src>python OpenOPCService.py debug

Firstly, I believe this is out of date, as it's actually gateway_service in OpenOPC 2. Secondly, thanks for including the service in the openopc2 Python package, as it enables me to not have to git clone this repo to install the service.

Now, after pip install openopc2 into a venv, I am trying to debug the Gateway service without using pyinstaller to compile it into an executable like so:

(venv) PS C:\path\to\repo> python -m openopc2.gateway_service debug
option -d not recognized
Usage: 'OpenOPCService.exe [options] install|update|remove|start [...]|stop|restart [...]|debug [...]'
Options for 'install' and 'update' commands only:
 --username domain\username : The Username the service is to run under
 --password password : The password for the username
 --startup [manual|auto|disabled|delayed] : How the service starts, default = manual
 --interactive : Allow the service to interact with the desktop.
 --perfmonini file: .ini file to use for registering performance monitor data
 --perfmondll file: .dll file to use when querying the service for
   performance data, default = perfmondata.dll
Options for 'start' and 'stop' commands only:
 --wait seconds: Wait for the service to actually start or stop.
                 If you specify --wait with the 'stop' option, the service
                 and all dependent services will be stopped, each waiting
                 the specified period.

(venv) PS C:\path\to\repo> python -m openopc2.gateway_service "debug"
option -d not recognized
Usage: 'OpenOPCService.exe [options] install|update|remove|start [...]|stop|restart [...]|debug [...]'
Options for 'install' and 'update' commands only:
 --username domain\username : The Username the service is to run under
 --password password : The password for the username
 --startup [manual|auto|disabled|delayed] : How the service starts, default = manual
 --interactive : Allow the service to interact with the desktop.
 --perfmonini file: .ini file to use for registering performance monitor data
 --perfmondll file: .dll file to use when querying the service for
   performance data, default = perfmondata.dll
Options for 'start' and 'stop' commands only:
 --wait seconds: Wait for the service to actually start or stop.
                 If you specify --wait with the 'stop' option, the service
                 and all dependent services will be stopped, each waiting
                 the specified period.

(venv) PS C:\path\to\repo> python -m openopc2.gateway_service -debug
option -d not recognized
Usage: 'gateway_service.py [options] install|update|remove|start [...]|stop|restart [...]|debug [...]'
Options for 'install' and 'update' commands only:
 --username domain\username : The Username the service is to run under
 --password password : The password for the username
 --startup [manual|auto|disabled|delayed] : How the service starts, default = manual
 --interactive : Allow the service to interact with the desktop.
 --perfmonini file: .ini file to use for registering performance monitor data
 --perfmondll file: .dll file to use when querying the service for
   performance data, default = perfmondata.dll
Options for 'start' and 'stop' commands only:
 --wait seconds: Wait for the service to actually start or stop.
                 If you specify --wait with the 'stop' option, the service
                 and all dependent services will be stopped, each waiting
                 the specified period.

(venv) PS C:\path\to\repo> python -m openopc2.gateway_service --debug
option --debug not recognized
Usage: 'gateway_service.py [options] install|update|remove|start [...]|stop|restart [...]|debug [...]'
Options for 'install' and 'update' commands only:
 --username domain\username : The Username the service is to run under
 --password password : The password for the username
 --startup [manual|auto|disabled|delayed] : How the service starts, default = manual
 --interactive : Allow the service to interact with the desktop.
 --perfmonini file: .ini file to use for registering performance monitor data
 --perfmondll file: .dll file to use when querying the service for
   performance data, default = perfmondata.dll
Options for 'start' and 'stop' commands only:
 --wait seconds: Wait for the service to actually start or stop.
                 If you specify --wait with the 'stop' option, the service
                 and all dependent services will be stopped, each waiting
                 the specified period.

The request is two parts:

  1. Fix the README.md to have the right command for local running
  2. Fix the ability to use the gateway service .py file without building an executable with pyinstaller?
renzop commented 1 year ago

You have to distiguish the two terms carfully: service --- referes to a windows service (program runs as a windows service) which can only be an executable, never a python programm

If you want the open opc gateway server to run as a python module (for testing and debugging for example) you can do so by:

python -m gateway_server.py