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

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

我试图找到解决斯坦福的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)

}
任何帮助都将不胜感激

2vuwiymt

2vuwiymt1#

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

相关问题