我试图找到解决斯坦福的cs246 2014硬件解决方案的最受欢迎的家伙在校园里。
我不断遇到错误“error:java.lang.runtimeexception:pipemapred.waitoutputthreads():subprocess failed with code 1”
我的mapper的python代码是
{#!/usr/bin/python
import sys
ID = None
fcount = 0
count = 0
for line in sys.stdin:
line = line.strip()
words = line.split(" ")
ID,friends = words
fcount = len(friends.split(","))
#count = fcount * -1
# for i in friends:
# if i != ','
# fcount +=1
print "%d\t%s" %(fcount,ID)
}
我的代码是
{
# !/usr/bin/python
import sys
ID = None
fcount = 0
count = 0
for line in sys.stdin:
line = line.strip()
words = line.split(" ")
ID,friends = words
fcount = len(friends.split(","))
#count = fcount * -1
# for i in friends:
# if i != ','
# fcount +=1
print "%d\t%s" %(fcount,ID)
}
任何帮助都将不胜感激
1条答案
按热度按时间2vuwiymt1#
终于想明白了。发生错误的原因是python的两个不同版本。我的系统上有python3,hadoop系统上有python2。