Open eliotb opened 1 year ago
In future? : Use the avahi-daemon instead of requiring the python zeroconf module for device discovery
This is not a portable solution. Aside from that, it'd likely require using their dbus API, which I am not looking forward to.
(? Ubuntu sets this to yes ?)
Correct, since 2007. I can't conveniently check the actual config that ships with e.g. arch or fedora, but I don't see them changing it in this area.
FWIW reading https://github.com/python-zeroconf/python-zeroconf/issues/967 I noticed we might be failing to bind (and just silently moving on) in some cases already — e.g. on macos. I will try to remember and verify this next week.
So far, I think this might warrant a note in the FAQ to fix avahi config, but nothing beyond that.
As well as a FAQ entry, I think the OSError should be caught and a warning logged instead of crashing. In my case I only had a USB device connected but I couldn't list_resources to start working with it.
ResourceManager.list_resources() fails with an unhandled exception when avahi-daemon and zeroconf are both installed.
avahi-daemon is part of the OS install that provides mDNS services for e.g. network printer discovery. pip installed zeroconf is required for hislip instrument discovery.
Here is a small example showing the traceback and error. This is executed in a venv with pyvisa, pyvisa-py, and zeroconf installed.
Workarounds
? Potentially a FAQ entry ?
avahi-daemon
to allow coexistence with python zeroconfEdit
/etc/avahi/avahi-daemon.conf
and add/uncomment linedisallow-other-stacks=no
then restart the daemon:
systemctl restart avahi-daemon.service
This comes with a warning in the manpage:
Output of
pyvisa-info