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

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

Open
amichelotti opened this issue Oct 7, 2024 · 1 comment

Comments

@amichelotti
Copy link

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
@mdavidsaver
Copy link
Member

"clients": [], <--- I thought that could be more permissive. But it makes the p4p crash.

This has the opposite effect. When combined with "statusprefix", this should create a server which only provides gateway status PVs. I suppose a valid use case, although not one I have tested. Which, python being so dynamic, probably explains why it doesn't work.

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

2 participants