Skip to content

Commit

Permalink
Fix device identification when accessing device that continually writes
Browse files Browse the repository at this point in the history
  • Loading branch information
GraysonBellamy committed Jun 11, 2024
1 parent 8381eee commit 2742cba
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pyalicat/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,15 @@ async def new_device(cls, port: str, id: str = "A", **kwargs: Any) -> Self:
"calibrated_by",
"software",
]
dev_info = dict(
zip(INFO_KEYS, [i[re.search(r"M\d\d", i).end() + 1 :] for i in dev_info])
)
try:
dev_info = dict(
zip(
INFO_KEYS, [i[re.search(r"M\d\d", i).end() + 1 :] for i in dev_info]
)
)
except AttributeError:
raise ValueError("No device found on port")
print(dev_info)
for cls in all_subclasses(Device):
if cls.is_model(dev_info["model"]):
new_cls = cls(device, dev_info, id, **kwargs)
Expand Down

0 comments on commit 2742cba

Please sign in to comment.