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

p4pgw crashes:"UnboundLocalError: local variable 'handler' referenced before assignment" #159

Open amichelotti opened 1 month ago

amichelotti commented 1 month ago

Hello, trying the following configuration p4p crashes:

config.json:

{
    "version": 2,
    "clients":[
        {
            "name":"cam1",
            "addrlist": "cam01.eli.svc",
            "autoaddrlist":false
        }
    ],
    "servers": [
        {
            "name": "$name",
            "clients": [],                        <--- I thought that could be more permissive. But it makes the p4p crash.
            "addrlist": "",
            "autoaddrlist": false,
            "statusprefix": "GW:STS:"
        }
    ]
}

Output:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/dist-packages/p4p/gw.py", line 815, in <module>
    main()
  File "/usr/local/lib/python3.10/dist-packages/p4p/gw.py", line 804, in main
    app = App(args)
  File "/usr/local/lib/python3.10/dist-packages/p4p/gw.py", line 672, in __init__
    handler.asTestPV = SharedPV(nt=NTScalar('s'), initial="Only RPC supported.")
UnboundLocalError: local variable 'handler' referenced before assignment