Sublime Forum

ImportError of python library during build for ROS

#1

Hi,

I’m trying to build a project using rosmake(ros.org/wiki/rosmake), which is a python build tool that checks for dependencies and build several different file types, it’s basically just a wrapper around make. However when I attempt to build with it, I get an ImportError saying that it can’t find one of the python libraries that is imported. Rosmake works on the command line, and I’ve tried setting shell to true, as well as writing a bash script that does what I want, and then calling the script, and lastly making sure all of my environment variables match between the build system, and my console. I’m at a loss at where to go from here.

Here is my build system file:

{ "shell": "True", "cmd": "rosmake"], "working_dir":"/home/user/directory" }

Here is the error encountered:
Traceback (most recent call last):
File “/opt/ros/fuerte/bin/rosmake”, line 40, in
import rosmake
ImportError: No module named rosmake
[Finished in 0.1s with exit code 1]

My guess is that since sublime is based on python, it is somehow interfering in the build process.

Any help would be greatly appreciated.

Thank You

0 Likes

#2

any ideas? I’m still stumped…

0 Likes

#3

Hi,
I think I just ran across a very similar problem (brand new install of ROS Fuerte on a clean install of Lubuntu 12.04, then installed ST)
I had a test script that worked fine from the command line (python xyz.py), but was erroring out when I tried to run it from inside ST with this error:

ImportError: No module named cv2

I found a similar issue here:

End result, the PYTHONPATH for ROS was different.
So my customized python build script looks like this now (called rospython.sublime-build)

{
	"env":
	{
    	"PYTHONPATH":"/opt/ros/fuerte/lib/python2.7/dist-packages:"
	},
	"cmd": "python", "$file"],
	"file_regex": "^ ]*File \"(...*?)\", line ([0-9]*)",
	"selector": "source.python"
}

Hope that helps or is a starting point for someone else with the same problem.
(note: I haven’t tried rosmake from within ST, so this might be a different issue, but it sounds similar.)

0 Likes