Boost.Python.ArgumentError: Python argument types in
时间: 2023-11-05 14:35:26 浏览: 550
这个错误通常是因为您在Python中向C++函数传递了不正确的参数类型。Boost.Python要求您明确指定C++函数的参数类型,以便正确地将Python对象转换为C++对象。如果您传递了不正确的参数类型,Boost.Python将会抛出一个ArgumentError异常。
您可以检查一下您的Python代码,确保您传递给C++函数的所有参数都是正确的类型。另外,您也可以检查一下C++函数的声明和定义,确保它们与Python代码中使用的参数类型相匹配。如果您使用了Boost.Python提供的类型转换器,可以尝试打印一些调试信息,以便更好地了解对象转换的过程。
相关问题
Boost.Python.ArgumentError: Python argument types in rdkit.Chem.rdMolDescriptors.GetMorganFingerprintAsBitVect(NoneType, int)
This error message indicates that there is a problem with the input arguments to the GetMorganFingerprintAsBitVect function from the RDKit module. Specifically, the first argument (the molecule object) is of type NoneType, which means that it is not a valid molecule object. The second argument (the radius of the fingerprint) is an integer, which is the correct type.
To fix this error, you need to make sure that the first argument is a valid molecule object. Check that the molecule object is being properly initialized or loaded before passing it to the function. If the molecule object is still NoneType after initialization or loading, then there may be an issue with the file or data source.
NPC.apply_control(VehicleControl(throttle=1.0, target_speed=50)) Boost.Python.ArgumentError: Python argument types in VehicleControl.__init__(VehicleControl)
这个错误提示意味着你在调用VehicleControl时没有正确传递参数。VehicleControl类需要至少一个参数,即throttle(油门)。你可以尝试以下代码:
```
from carla import VehicleControl
NPC.apply_control(VehicleControl(throttle=1.0, steer=0.0, brake=0.0, hand_brake=False, reverse=False, manual_gear_shift=False, gear=0, target_speed=50))
```
这里,除了throttle之外,其他参数都是可选的,如果你不需要使用它们,可以将它们省略。同时,也要确保你已经正确导入了VehicleControl类。
阅读全文