Home Download Buy Blog Forum Support

ImportError of python library during build for ROS

ImportError of python library during build for ROS

Postby cbames on Mon Dec 10, 2012 10:48 pm

Hi,

I'm trying to build a project using rosmake(http://www.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:
Code: Select all
{
   "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 <module>
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
cbames
 
Posts: 2
Joined: Mon Dec 10, 2012 10:37 pm

Re: ImportError of python library during build for ROS

Postby cbames on Tue Dec 11, 2012 9:14 pm

any ideas? I'm still stumped...
cbames
 
Posts: 2
Joined: Mon Dec 10, 2012 10:37 pm

Re: ImportError of python library during build for ROS

Postby Coinbird on Thu Jan 03, 2013 7:37 am

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:
Code: Select all
ImportError: No module named cv2


I found a similar issue here:
stackoverflow.com/questions/8574919/sublime-text-2-custom-path-and-pythonpath/9919953#9919953

End result, the PYTHONPATH for ROS was different.
So my customized python build script looks like this now (called rospython.sublime-build)
Code: Select all
{
   "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.)
Coinbird
 
Posts: 1
Joined: Thu Jan 03, 2013 7:31 am


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 28 guests