Skip to content
Open
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
8 changes: 6 additions & 2 deletions bindings/python/examples/iio_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ def _create_context():
print("Multiple contexts found. Please select one using --uri:")
for uri, description in contexts.items():
print("\t%s: %s" % (uri, description))
sys.exit(0)
sys.exit(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change on this line doesn't make sense to me as it prints only the first item, then immediately exits. What we want is to print all contexts.

if len(contexts) == 0:
print("No contexts found.")
sys.exit(0)
uri = list(contexts.keys())[0]

return iio.Context(uri)

Expand All @@ -55,7 +59,7 @@ def write_information(self):

def _context_info(self):
print("IIO context created: " + self.context.name)
print("Backend version: %u.%u (git tag: %s" % self.context.version)
print("Backend version: %u.%u (git tag: %s)" % self.context.version)
print("Backend description string: " + self.context.description)

if len(self.context.attrs) > 0:
Expand Down