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

Device List doesnot work with python bindings #2332

Closed
pulkitag opened this issue Aug 31, 2018 · 2 comments
Closed

Device List doesnot work with python bindings #2332

pulkitag opened this issue Aug 31, 2018 · 2 comments
Assignees
Labels

Comments

@pulkitag
Copy link

Camera Model: D435
Firmware Version: 05.08.15.00
Operating Version: Ubuntu 18.04
Kernel Version: 4.15.0-32
Platform: PC
SDK Version: 2.16.0
Language: Python

Issue Description

I run the following

import pyrealsense2 as pr
deviceList  = pr.device_list()
print (deviceList.size())

I get the response as 0.

However, when I run the same code through C++, I get the response as 1. This is a problem because now I cannot access individual devices through Python, but I can easily do this using C++.

Furthermore, I have no problems getting data through pipeline in python. So python-api is certainly able to read data from the camera, but somehow doesnot list the devices. Any clues/pointers on what might be happening?

@holowgen
Copy link

import pyrealsense2 as rs
ctx = rs.context()
if len(ctx.devices) > 0:
for d in ctx.devices:
print ('Found device: ',
d.get_info(rs.camera_info.name), ' ',
d.get_info(rs.camera_info.serial_number))
else:
print("No Intel Device connected")

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
Hi pulkitag,

Please try the code sample below and it should fix your issue.
Thanks holowgen for sharing a solution.

Please see the details of wrapper definitions here:

rss_context.cpp
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/python.cpp#L214

rs2_device.hpp
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/python.cpp#L236

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants