2016-04-24 178 views
0

这让我疯狂,我已经尝试了很多东西,例如。改变语言环境,但仍然在工作空间初始化后,然后在subdir上执行catkin_make。无法运行catkin_make,无法解析UnicodeDecodeError

运行在最近的一个拱DIST,罗斯 - 靛蓝,python2.7和python 3.5安装

[email protected]:~/ros$ catkin_make 
Base path: /home/johnny/ros 
Source space: /home/johnny/ros/src 
Build space: /home/johnny/ros/build 
Devel space: /home/johnny/ros/devel 
Install space: /home/johnny/ros/install 
#### 
#### Running command: "cmake /home/johnny/ros/src -DCATKIN_DEVEL_PREFIX=/home/johnny/ros/devel -DCMAKE_INSTALL_PREFIX=/home/johnny/ros/install -G Unix Makefiles" in "/home/johnny/ros/build" 
#### 
-- Using CATKIN_DEVEL_PREFIX: /home/johnny/ros/devel 
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo 
-- This workspace overlays: /opt/ros/indigo 
-- Using PYTHON_EXECUTABLE: /usr/bin/python 
-- Using default Python package layout 
-- Using empy: /usr/lib/python2.7/site-packages/em.py 
-- Using CATKIN_ENABLE_TESTING: ON 
-- Call enable_testing() 
-- Using CATKIN_TEST_RESULTS_DIR: /home/johnny/ros/build/test_results 
-- Found gtest: gtests will be built 
CMake Warning at /opt/ros/indigo/share/catkin/cmake/test/nosetests.cmake:96 (message): 
    nosetests not found, Python tests can not be run (try installing package 
    'python3-nose') 
Call Stack (most recent call first): 
    /opt/ros/indigo/share/catkin/cmake/all.cmake:147 (include) 
    /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:20 (include) 
    CMakeLists.txt:52 (find_package) 


-- catkin 0.6.18 
-- BUILD_SHARED_LIBS is on 
/opt/ros/indigo/share/catkin/cmake/em/order_packages.cmake.em:23: error: <class 'UnicodeDecodeError'>: 'ascii' codec can't decode byte 0xc3 in position 205: ordinal not in range(128) 
Traceback (most recent call last): 
    File "/usr/lib/python2.7/site-packages/em.py", line 3302, in <module> 
    if __name__ == '__main__': main() 
    File "/usr/lib/python2.7/site-packages/em.py", line 3300, in main 
    invoke(sys.argv[1:]) 
    File "/usr/lib/python2.7/site-packages/em.py", line 3283, in invoke 
    interpreter.wrap(interpreter.file, (file, name)) 
    File "/usr/lib/python2.7/site-packages/em.py", line 2295, in wrap 
    self.fail(e) 
    File "/usr/lib/python2.7/site-packages/em.py", line 2284, in wrap 
    callable(*args) 
    File "/usr/lib/python2.7/site-packages/em.py", line 2359, in file 
    self.safe(scanner, done, locals) 
    File "/usr/lib/python2.7/site-packages/em.py", line 2401, in safe 
    self.parse(scanner, locals) 
    File "/usr/lib/python2.7/site-packages/em.py", line 2421, in parse 
    token.run(self, locals) 
    File "/usr/lib/python2.7/site-packages/em.py", line 1425, in run 
    interpreter.execute(self.code, locals) 
    File "/usr/lib/python2.7/site-packages/em.py", line 2595, in execute 
    _exec(statements, self.globals, locals) 
    File "<string>", line 17, in <module> 
    File "/usr/lib/python2.7/site-packages/catkin_pkg/topological_order.py", line 111, in topological_order 
    for path, package in find_packages(space).items(): 
    File "/usr/lib/python2.7/site-packages/catkin_pkg/packages.py", line 83, in find_packages 
    packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, warnings=warnings) 
    File "/usr/lib/python2.7/site-packages/catkin_pkg/packages.py", line 110, in find_packages_allowing_duplicates 
    packages[path] = parse_package(os.path.join(basepath, path), warnings=warnings) 
    File "/usr/lib/python2.7/site-packages/catkin_pkg/package.py", line 370, in parse_package 
    return parse_package_string(f.read(), filename, warnings=warnings) 
    File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode 
    return codecs.ascii_decode(input, self.errors)[0] 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 205: ordinal not in range(128) 
CMake Error at /opt/ros/indigo/share/catkin/cmake/safe_execute_process.cmake:11 (message): 
    execute_process(/home/johnny/ros/build/catkin_generated/env_cached.sh 
    "/usr/bin/python" "/usr/lib/python2.7/site-packages/em.py" "--raw-errors" 
    "-F" "/home/johnny/ros/build/catkin_generated/order_packages.py" "-o" 
    "/home/johnny/ros/build/catkin_generated/order_packages.cmake" 
    "/opt/ros/indigo/share/catkin/cmake/em/order_packages.cmake.em") returned 
    error code 1 
Call Stack (most recent call first): 
    /opt/ros/indigo/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process) 
    /opt/ros/indigo/share/catkin/cmake/catkin_workspace.cmake:35 (em_expand) 
    CMakeLists.txt:63 (catkin_workspace) 


-- Configuring incomplete, errors occurred! 
See also "/home/johnny/ros/build/CMakeFiles/CMakeOutput.log". 
See also "/home/johnny/ros/build/CMakeFiles/CMakeError.log". 
Invoking "cmake" failed' 

非常感谢您!

回答

0

它看起来像一个unicode问题。在非常简短的总结中,你已经将一些被解释为字节串的东西传递给需要将其解码为Unicode字符的东西,但是默认编解码器(ascii)失败。 更多关于这个here

这里有很多解决方案。一个我认为是这样做的:

[email protected]:/usr/local/lib/python2.7/site-packages# cat sitecustomize.py 
# encoding=utf8 
import sys 

reload(sys) 
sys.setdefaultencoding('utf8') 

,并检查其是否正常工作,你需要做到以下几点:

[email protected]:~/home# python 
Python 2.7.6 (default, Dec 6 2013, 14:49:02) 
[GCC 4.4.5] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import sys 
>>> reload(sys) 
<module 'sys' (built-in)> 
>>> sys.getdefaultencoding() 
'utf8' 
>>> 

希望它能帮助!干杯。