0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Python _csv.Error: field larger than field limit (131072) エラーへの対応

Posted at

目的および背景

行数の多いCSVファイルを書き出すプログラムコードを実行したところ、以下のエラーが発生したため対応しました。

_csv.Error: field larger than field limit (131072)

原因

大きいサイズのCSVファイルを処理しようとしたため発生しました。

プログラムコード

field_size_limitの値を変更しました。

_csv.Error: field larger than field limit (131072) エラー対策
maxInt = sys.maxsize
while True:
    try:
        csv.field_size_limit(maxInt)
        break
    except OverflowError:
        maxInt = int(maxInt/10)

参照

以下のページを参考にさせていただきました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?