Autocomplete in Eclipse with Catkin and Python Packages
So, i'm attempting to write a Python Module within a ROS Package (using Catkin)
I have the following directory structure
package_name
CMakeLists.txt
setup.py
- src
- package_name (again)
- module_1
__init__.py (blank)
SourceFileWithClassesAndWhatnot1.py
- module_2
__init__.py (blank)
SourceFileWithClassesAndWhatnot2.py
- module_3
__init__.py (blank)
SourceFileWithClassesAndWhatnot3.py
In my CMakeLists, I have uncommented the catkin_python_setup()
and catkin_package()
calls. However, I am not seeing any of these modules come up when I use autocomplete in eclispe. I've edited my eclipse .desktop file with the bash -i -c eclipse
command.
Here are the contents of my setup.py
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['heres_how_python_utils.conversions', 'heres_how_python_utils.services', 'heres_how_python_utils.json'],
package_dir={'': 'src'}
)
print(setup(**d))
Any thoughts as to why this might not be working? I have other python modules set up in the same workspace which are autocompleting nicely.
Thanks!
I've found that the
setup.sh
command sets up the PYTHONPATH to use the /devel directory. However, in this directory, /package_name only has an __init__ file, which has a bunch of auto-generated import code in it. How can I set the PYTHONPATH to use the src directory instead?It must be set to the devel folder if you have any generated code (like messages or services). Otherwise you can manually set it to the source folder. The __init__.py files in the devel folder will probably mess with any kind of tab completion stuff.