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

Added try...except for unconnected components when using apstools.uti… #846

Merged
merged 1 commit into from
May 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions apstools/utils/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ def _all_signals(base):
items = []
if hasattr(base, "component_names"):
for k in base.component_names:
obj = getattr(base, k)
# Check for lazy components that may not be connected
try:
obj = getattr(base, k)
except TimeoutError:
logger.warning(f"Could not list component: {base.name}.{k}")
continue
if isinstance(obj, (Device, Signal)):
items += _all_signals(obj)
return items
Expand Down Expand Up @@ -90,10 +95,11 @@ def listdevice(
show_ancient=True,
table_style=TableStyle.pyRestTable,
):
"""
Describe the signal information from device ``obj`` in a pandas DataFrame.
"""Describe the signal information from device ``obj`` in a pandas DataFrame.

Look through all subcomponents to find all the signals to be shown.
Look through all subcomponents to find all the signals to be
shown. Components that are disconnected will be skipped and a
warning logged.

PARAMETERS

Expand Down Expand Up @@ -141,6 +147,7 @@ def listdevice(

.. note:: ``pandas.DataFrame`` wll truncate long text
to at most 50 characters.

"""
scope = (scope or "full").lower()
signals = _all_signals(obj)
Expand Down