简体   繁体   中英

Convert C++ enum to python int

I have a python wrapper for a C++ function that returns an enum.

When I do the following:

returnValue = mylibrary_py.getRole() # this returns an enum

I get the following error when I load my web page:

No to_python (by-value) converter found for C++ type: mynamespace::MyRole

How can I solve this??

How is the Python wrapper generated? Enum's convert implicitly to int (and to other integral types), so the Python wrapper must be doing something special to prevent this.

在下面找到如何将枚举类型公开给python的方法: 从C ++到Python的枚举

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM