2013-08-30 56 views
3
# pick up the file which needs to be processed 
    current_file = file_names[0] 
    print "Processing current file: " + current_file 

    key = bucket.get_key(current_file) 
    print "Processing key: " + str(key) 
    key.get_contents_to_filename(working_dir + "test_stats_temp.dat") 
    print "Current directory: ",outputdir 
    print "File to process:",current_file 

处理测试输出为:DS = 2013年8月27日IO错误:没有这样的文件或目录:

处理当前文件:输出/ test_count_day/DS = 2013年8月27日/ task_201308270934_0003_r_000000

处理项:项:hadoop.test.com,输出/ test_count_day/DS = 2013年8月27日/ task_201308270934_0003_r_000000

Traceback (most recent call last): 
     File "queue_consumer.py", line 493, in <module> 
     test_process.load_test_cnv_stats_daily(datestring,working_dir,mysqlconn,s3_conn,test_output_bucket,test_output) 
     File "/home/sbr/aaa/test_process.py", line 46, in load_test_cnv_stats_daily 
     key.get_contents_to_filename(working_dir + "test_stats_temp.dat") 
     File "/usr/lib/python2.7/dist-packages/boto/s3/key.py", line 1275, in get_contents_to_filename 
     fp = open(filename, 'wb') 
    IOError: [Errno 2] No such file or directory: '/home/sbr/aaa/test_stats_temp.dat' 

我得到这个错误,当我从S3输出取回的数据为DB。我很困惑。如何处理这个问题?

+1

您的'working_dir'是否存在? – datasage

+0

感谢您的回复!我修好了它 !! – brisk

+0

@datasage - 你可以将你的评论变成一个答案,即使它是一个快速修复。提供更好的可见性,以防将来任何人面临这种​​情况:) – andreimarinescu

回答

2

错误:

IOError: [Errno 2] No such file or directory: '/home/sbr/aaa/test_stats_temp.dat'

表示与working_dir设置的路径不存在。创建目录将修复它。

相关问题