ros / dynamic_reconfigure

BSD 3-Clause "New" or "Revised" License
48 stars 111 forks source link

'ImportError: No module named client' while importing dynamic_reconfigure.client #162

Open iamrajee opened 3 years ago

iamrajee commented 3 years ago

I'm trying to import dynamic_reconfigure.client in python as below

#!/usr/bin/env python
import roslib;roslib.load_manifest('dynamic_reconfigure')
import rospy
import dynamic_reconfigure.client //This gives "No module named client" error

But I'm getting ImportError: No module named client. If I only import dynamic_reconfigure and try to call dynamic_reconfigure.client then I'm getting AttributeError: 'module' object has no attribute 'client' error.

I've also added dynamic_reconfigure in CMakeList as

find_package(catkin REQUIRED COMPONENTS
  dynamic_reconfigure
)

My system information is OS: Ubuntu 18.04 ROS: Melodic

Let me know if there is anything else you would want to know. Thanks!

Gowresh-MARC commented 2 years ago

Hello,

Was this issue solved? I a m getting the same error and i am using melodic in ubuntu 18.04 as well.

I tried the same script in noetic in Ubuntu 20.04 and it works perfectly there.

iamrajee commented 2 years ago

@Gowresh-MARC No, it wasn't resolved. I tried the following ways to import clients in my code:

import dynamic_reconfigure
# from dynamic_reconfigure import client
# from dynamic_reconfigure import *
# import dynamic_reconfigure.client
# from dynamic_reconfigure.client import Client
# from dynamic_reconfigure.dynamic_reconfigure.server import Server

But it dint helped. Thanks!

MatthijsBurgh commented 2 years ago

No need to import roslib and load the manifest.

I think your PYTHONPATH is incorrect. So print that, best inside your script

iamrajee commented 2 years ago

No need to import roslib and load the manifest.

I think your PYTHONPATH is incorrect. So print that, best inside your script

++

Gowresh-MARC commented 2 years ago

No need to import roslib and load the manifest.

I think your PYTHONPATH is incorrect. So print that, best inside your script

These are my PYTHONPATHS:-

['/home/marc/linorobot_ws/devel/lib/python2.7/dist-packages', '/opt/ros/melodic/lib/python2.7/dist-packages']

MatthijsBurgh commented 2 years ago

Do you have any version of dynamic_reconfigure in your own ws? Or only the system installed version?

To be sure, try the following

PYTHONPATH=/opt/ros/melodic/lib/python2.7/dist-packages python -c "import dynamic_reconfigure.client"