hadooppython作业在使用echo的代码正常工作时给了我一个错误

zf9nrax1  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(348)

我试图找到解决斯坦福的cs246 2014硬件解决方案的最受欢迎的家伙在校园里。
我不断遇到错误“error:java.lang.runtimeexception:pipemapred.waitoutputthreads():subprocess failed with code 1”
我的mapper的python代码是

  1. {#!/usr/bin/python
  2. import sys
  3. ID = None
  4. fcount = 0
  5. count = 0
  6. for line in sys.stdin:
  7. line = line.strip()
  8. words = line.split(" ")
  9. ID,friends = words
  10. fcount = len(friends.split(","))
  11. #count = fcount * -1
  12. # for i in friends:
  13. # if i != ','
  14. # fcount +=1
  15. print "%d\t%s" %(fcount,ID)
  16. }

我的代码是
{

  1. # !/usr/bin/python
  2. import sys
  3. ID = None
  4. fcount = 0
  5. count = 0
  6. for line in sys.stdin:
  7. line = line.strip()
  8. words = line.split(" ")
  9. ID,friends = words
  10. fcount = len(friends.split(","))
  11. #count = fcount * -1
  12. # for i in friends:
  13. # if i != ','
  14. # fcount +=1
  15. print "%d\t%s" %(fcount,ID)

}
任何帮助都将不胜感激

2vuwiymt

2vuwiymt1#

终于想明白了。发生错误的原因是python的两个不同版本。我的系统上有python3,hadoop系统上有python2。

相关问题