2013-08-30 54 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設置的路徑不存在。創建目錄將修復它。

相關問題