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

Error when running example code #1

Open
martinakos opened this issue Jan 28, 2020 · 2 comments
Open

Error when running example code #1

martinakos opened this issue Jan 28, 2020 · 2 comments

Comments

@martinakos
Copy link

martinakos commented Jan 28, 2020

First of all, thanks for this library!

I installed it following your instructions and it seems it installed correctly.
However, when I run your example code I get this error:

TypeError: unbound method get_installed_count() must be called with Device instance as first argument (got nothing instead)

when running the line

print(pyk4a.Device.get_installed_count())

and similar error:

TypeError: unbound method open() must be called with Device instance as first argument (got int instance instead)

when running:

device=pyk4a.Device.open(pyk4a.K4A_DEVICE_DEFAULT)

Do you know what could be the problem?

@martinakos martinakos changed the title TypeError: unbound method get_installed_count() must be called with Device instance as first argument (got nothing instead) Error when running example code Jan 28, 2020
@martinakos
Copy link
Author

The error above happens in python2.7. I've been able to run the example code successfully in python3.5. Still, because of other dependencies I need to use python2.7. how could this error be solved for python2.7?

@martinakos
Copy link
Author

I found a solution. I changed some of the .def in the pyk4a.cpp file for .def_static and rebuild, then it work for python2.7 too. More specifically I changed the lines 313,314

            .def_static("open", &pyk4adevice::open)
            .def_static("get_installed_count", &pyk4adevice::get_installed_count)

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

No branches or pull requests

1 participant