【问题标题】:IOError: No such file or directory:IOError:没有这样的文件或目录:
【发布时间】:2013-09-03 00:16:53
【问题描述】:
 # 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-08-27

处理当前文件:output/test_count_day/ds=2013-08-27/task_201308270934_0003_r_000000

处理键:键:hadoop.test.com,output/test_count_day/ds=2013-08-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 时,出现此错误。我在这里很困惑。如何处理这个问题?

【问题讨论】:

  • 你的working_dir 存在吗?
  • 感谢您的回复!!我修好了!!
  • @datasage - 你可以将你的评论变成一个答案,即使它是一个快速修复。提供更好的可见性,以防将来有人遇到这种情况:)

标签: python-2.7 amazon-web-services amazon-s3 boto


【解决方案1】:

错误:

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

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

【讨论】:

  • @brisk 做到了吗?因为我遇到了类似的问题,而这个解决方案对我不起作用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-08
  • 2018-04-19
  • 2021-09-02
相关资源
最近更新 更多