epics-base / p4p

Python bindings for the PVAccess network client and server.
BSD 3-Clause "New" or "Revised" License
27 stars 38 forks source link

KeyError: '\n "version"' #93

Closed hjunkes closed 1 year ago

hjunkes commented 2 years ago

When I follow the gateway instructions I get the following error: (p4ptest) root@felpvagate:~# python -m p4p.gw --example-config /etc/pvagw/mygw.conf Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/root/p4ptest/lib/python3.9/site-packages/p4p/gw.py", line 799, in main() File "/root/p4ptest/lib/python3.9/site-packages/p4p/gw.py", line 763, in main O.write(F.read().format( KeyError: '\n "version"'

mdavidsaver commented 2 years ago

Should be fixed by 9730e6117c345ff804c74fc7a0d9dd0b4c4bd36f

hjunkes commented 2 years ago

Now I run into this problem :

root@felpvagate:~# systemctl status pvagw@mygw.service
● pvagw@mygw.service - PVA Gateway (FEL-gateway)
     Loaded: loaded (/etc/systemd/system/pvagw@.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2022-11-02 18:50:56 CET; 3s ago
    Process: 54093 ExecStart=/usr/bin/python3 -m p4p.gw /etc/pvagw/mygw.conf (code=exited, status=1/FAILURE)
   Main PID: 54093 (code=exited, status=1/FAILURE)
        CPU: 367ms

Nov 02 18:50:56 felpvagate pvagw-FEL[54093]:     exec(code, run_globals)
Nov 02 18:50:56 felpvagate pvagw-FEL[54093]:   File "/usr/local/lib/python3.9/dist-packages/p4p/gw.py", line 799, in <modul>
Nov 02 18:50:56 felpvagate pvagw-FEL[54093]:     main()
Nov 02 18:50:56 felpvagate pvagw-FEL[54093]:   File "/usr/local/lib/python3.9/dist-packages/p4p/gw.py", line 788, in main
Nov 02 18:50:56 felpvagate pvagw-FEL[54093]:     app = App(args)
Nov 02 18:50:56 felpvagate pvagw-FEL[54093]:   File "/usr/local/lib/python3.9/dist-packages/p4p/gw.py", line 532, in __init>
Nov 02 18:50:56 felpvagate pvagw-FEL[54093]:     _log.error.write('Syntax Error in %s: %s\n'%(args.config, e.args))
Nov 02 18:50:56 felpvagate pvagw-FEL[54093]: AttributeError: 'function' object has no attribute 'write'
Nov 02 18:50:56 felpvagate systemd[1]: pvagw@mygw.service: Main process exited, code=exited, status=1/FAILURE
Nov 02 18:50:56 felpvagate systemd[1]: pvagw@mygw.service: Failed with result 'exit-code'.

(I just copied the updated gw.py to /usr/local/lib/python3.9/dist-packages/p4p/gw.py )

But I think I did something wrong in general when setting up? python vs. python3? Danke Heinz

mdavidsaver commented 2 years ago

But I think I did something wrong in general when setting up?

There was an error in my error handling code, which should be fixed by fc070b22445eed43b354541691e4e8ee5950bf17

Of course this indicates that there is a syntax error in /etc/pvagw/mygw.conf.

fyi. one way you can update+rebuild from VCS as follows. When switching from pre-built to locally built, you will need to re-build the library packages as well due to c++ fun.

pip uninstall epicscorelibs pvxslibs p4p
pip install -v \
 --no-binary epicscorelibs \
 --no-binary pvxslibs \
 --no-binary p4p \
 git+https://github.com/mdavidsaver/p4p@master
mdavidsaver commented 1 year ago

I take silence to mean that these fixes were sufficient.