文件名太长

问题描述

在本地存储库中,我有几个 json 文件。当我运行命令时

from datasets import load_dataset
dataset = load_dataset('json',data_files=['./100009.json'])

我收到以下错误:

OSError: [Errno 36] File name too long: '/home/infinity/.cache/huggingface/datasets/_home_infinity_.cache_huggingface_datasets_json_default-80a93068b3a4a494_0.0.0_83d5b3a2f62630efc6b5315f00f20209b4ad91a00ac586597caee3a4da0bef02.lock'

也许很明显,但我不知道如何解决。你能帮忙吗?

编辑

这里是json文件的内容:

{
    "id": "68af48116a252820a1e103727003d1087cb21a32","article": [
        "by mark duell .","published : .","05:58 est,10 september 2012 .","| .","updated : .","07:38 est,"a pet owner starved her two dogs so badly that one was forced to eat part of his mother 's dead body in a desperate attempt to survive .","the mother died a ` horrendous ' death and both were in a terrible state when found after two weeks of starvation earlier this year at the home of katrina plumridge,31,in grimsby,lincolnshire .","the barely-alive dog was ` shockingly thin ' and the house had a ` nauseating and overpowering ' stench,grimsby magistrates court heard .","warning : graphic content .","horrendous : the male dog,scrappy -lrb- right -rrb-,was so badly emaciated that he ate the body of his mother ronnie -lrb- centre -rrb- to try to survive at the home of katrina plumridge in grimsby,"the suffering was so serious that the female staffordshire bull terrier,named ronnie,died of starvation,nigel burn,prosecuting,told the court last friday .","suspended jail term : the dogs were in a terrible state when found after two weeks of starvation at the home of katrina plumridge,31 -lrb- pictured -rrb- .","the male dog,her son scrappy,was so badly emaciated that he ate her body to try to survive .","` the degree of suffering caused to both dogs was extreme and prolonged,' mr burn said . ` it was as severe and extreme as it can get . '","the alarm was raised when a letting agent visited her home and saw dog mess on the steps,stairs,an upstairs floor and a bed .","a painfully thin dog jumped past him . he said its ribs,spine and hip bones could all be seen and it was the thinnest dog he had ever witnessed .","he tried to go into the kitchen but it was blocked from the inside by the dead body of the mother dog . the letting agent then called the royal society for the prevention of cruelty to animals .","mr burn said : ` every single bone in its frame was visible and the stomach was curved in . the empty dog bowls were bone dry . '","a decorator who went into the house said the stench made him feel physically sick,ronnie was like a skeleton and scrappy was ` shockingly thin ' .","a veterinary surgeon estimated that the dogs would have been suffering from starvation for at least two weeks .","plumridge moved out of the house on march 28 but the dogs were n't found until april 19 . she had claimed a friend was supposed to be finding new homes for the dogs and left them without going back to check on them .",],"abstract": [
        "neglect by katrina plumridge saw staffordshire bull terrier ronnie die .","dog 's son scrappy was forced to eat her to survive at grimsby house .","alarm raised by letting agent shocked by ` thinnest dog he 'd ever seen '",]

解决方法

处理大型数据集时,最好使用 Pandas 数据框。

import pandas as pd 
df= pd.read_json(r'Path where you saved the JSON file\File Name.json') 
print (df)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...