Ask Your Question
1

Error on genmsg/template_tools.py (AttributeError: 'module' object has no attribute 'Interpreter')

asked 2015-07-24 01:54:37 -0500

Hi all, I want to generate msg header files in a 64-bit Ubuntu 12.04 (ROS Hydro) by catkin_make agile_grasp_generate_messages. However, I got some error messages indicating that there's no Interpreter() in em module as the error occurs at the line interpreter = em.Interpreter(...) in genmsg/template_tools.py.

I think the error might relates to anaconda I installed before, because when I type python in my terminal, I got:

Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar  9 2015, 16:20:48) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>>

and when I locate em.py, there are many candidates: (but those em.py under nltk dir do not contain class Interpreter)

/home/rosfuerte/anaconda/lib/python2.7/site-packages/nltk/cluster/em.py
/home/rosfuerte/anaconda/lib/python2.7/site-packages/nltk/cluster/em.pyc
/home/rosfuerte/anaconda/pkgs/nltk-3.0.2-np19py27_0/lib/python2.7/site-packages/nltk/cluster/em.py
/home/rosfuerte/anaconda/pkgs/nltk-3.0.2-np19py27_0/lib/python2.7/site-packages/nltk/cluster/em.pyc
/usr/lib/pymodules/python2.7/em.py
/usr/lib/pymodules/python2.7/em.pyc
/usr/local/lib/python2.7/dist-packages/nltk/cluster/em.py
/usr/local/lib/python2.7/dist-packages/nltk/cluster/em.pyc
/usr/share/pyshared/em.py
/usr/share/software-center/softwarecenter/ui/gtk3/em.py

So I remove the anoconda from my path by export PATH=... to remove anaconda/bin from PATH variable. After that, when I type python, I got:

Python 2.7.3 (default, Jun 22 2015, 19:33:41) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

But even I set the PATH to exlude anaconda/bin, I still got the same error when I catkin_make agile_grasp_generate_messages. Does anyone know how to solve this problem?

FYI, here's my error messages: (I think the key error is AttributeError: 'module' object has no attribute 'Interpreter')

Generating Lisp code from agile_grasp/Grasps.msg
Generating Lisp code from agile_grasp/CloudSized.msg
Generating Lisp code from agile_grasp/Grasp.msg
Generating EusLisp code from agile_grasp/Grasp.msg
Generating EusLisp code from agile_grasp/CloudSized.msg
Generating EusLisp code from agile_grasp/Grasps.msg
[ 57%] Generating C++ code from agile_grasp/Grasp.msg
Generating EusLisp manifest code for agile_grasp
[ 64%] Traceback (most recent call last):
  File "/opt/ros/hydro/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line 49, in <module>
    srv_template_map)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 215, in generate_from_command_line_options
    generate_from_file(argv[1], options.package, options.outdir, options.emdir, options.includepath, msg_template_dict, srv_template_dict)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 156, in generate_from_file
    _generate_msg_from_file(input_file, output_dir, template_dir, search_path, package_name, msg_template_dict)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools.py", line 101, in _generate_msg_from_file
    search_path)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/genmsg/template_tools ...
(more)
edit retag flag offensive close merge delete

Comments

I just ran into the same error and reported it as a bug in the rosserial repo. Were you ever able to resolve this?

Cerin gravatar imageCerin ( 2015-12-13 21:15:22 -0500 )edit

Any news? I'm kind of having the same problem with anaconda

silgon gravatar imagesilgon ( 2015-12-15 07:48:33 -0500 )edit

Just passing by. You should install python module empy rather than empty and em.

yenWu gravatar imageyenWu ( 2018-01-03 07:30:22 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-03-24 23:21:05 -0500

Cerin gravatar image

Answered here.

The problem is that there are two conflicting Python packages installed, "em" and "empy", which unfortunately both create the package "em". EmPy is used by catkin, and what it expects, so you'll need to uninstall em to fix the error.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-07-24 01:54:37 -0500

Seen: 1,723 times

Last updated: Mar 24 '16