Ask Your Question


asked 2016-12-05 08:20:29 -0600

raada gravatar image

updated 2016-12-05 10:53:09 -0600

gvdhoorn gravatar image


I installed ROS Kinetic on Ubuntu 16.04 into Docker container. I created catkin workspace according to beginners tutorial. But when I try to create package, I get following exception:

$ catkin_create_pkg ahoj
Traceback (most recent call last):
  File "/usr/local/bin/catkin_create_pkg", line 68, in <module>
  File "/usr/local/bin/catkin_create_pkg", line 61, in main
  File "/usr/local/lib/python3.5/dist-packages/catkin_pkg/", line 209, in create_package_files
    _safe_write_files(newfiles, target_path)
  File "/usr/local/lib/python3.5/dist-packages/catkin_pkg/", line 185, in _safe_write_files
TypeError: a bytes-like object is required, not 'str'

Did you meed this situation somebody? It seems like function _safe_write_files fhand.write expects different data type than what it gets, but I don't understand why.

Thanks in advance for any idea, Radim

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-12-05 09:42:47 -0600

Dirk Thomas gravatar image

Your stacktrace shows that you have installed catkin_pkg for Python 3.5. The Debian package provided in the Xenial repository from ROS is using Python 2. So it looks like you have diverged from how you setup ROS on your machine.

You should uninstall catkin_pkg from /usr/local and follow the installation instructions:

edit flag offensive delete link more


Thank you - this was the reason!

I installed MORSE simulator from source code that requires python3 and I built catkin_create_pkg using python3 as its dependency. So the problem was between chair and keyboard;-)

raada gravatar imageraada ( 2016-12-05 10:48:15 -0600 )edit

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


Asked: 2016-12-05 08:20:29 -0600

Seen: 181 times

Last updated: Dec 05 '16