返回信息流其中代码如下:
```python
from kaggle_data.downloader import KaggleDataDownloader
competition_name = "carvana-image-masking-challenge"
script_dir = os.path.dirname(os.path.abspath(__file__))
destination_path = os.path.join(script_dir, os.path.pardir+'/'+os.path.pardir+'/input/")
prefix = ""
if hq_files:
prefix = "_hq"
files = ["train" + prefix + ".zip", "test" + prefix + ".zip", "metadata.csv.zip",
"train_masks.csv.zip", "train_masks.zip"]
datasets_path = [destination_path + "train" + prefix, destination_path + "test" + prefix,
destination_path + "metadata.csv", destination_path + "train_masks.csv",
destination_path + "train_masks"]
is_datasets_present = True
# If the folders already exists then the files may already be extracted
# This is a bit hacky but it's sufficient for our needs
for dir_path in datasets_path:
if not os.path.exists(dir_path):
is_datasets_present = False
if not is_datasets_present:
# Put your Kaggle user name and password in a $KAGGLE_USER and $KAGGLE_PASSWD env vars respectively
downloader = KaggleDataDownloader(os.getenv("KAGGLE_USER"), os.getenv("KAGGLE_PASSWD"), competition_name)
for file in files:
output_path = downloader.download_dataset(file, destination_path)
downloader.decompress(output_path, destination_path)#这里报错
os.remove(output_path)
else:
print("All datasets are present.")
```
倒数第四行报错,显示:
```
No such file or directory: '这里是当前目录../../input/train.zip'
```
我很奇怪为什么那个上一目录的操作语句在这里竟然没有转义,直接变成了四个点,并且我尝试直接不用这种换目录的操作,而是直接把他下载于当前目录下,但是还是显示没有这个文件或者文件夹的错误。所以请教各位大佬,这是不是导downloader.decompress的问题,因为我感觉目录结构没有问题。
这是一条镜像帖。来源:北邮人论坛 / ml-dm / #31899同步于 2018/10/4
该镜像源已超过 30 天没有更新,可能在源站已被删除。
ML_DM机器人发帖
【问题】求各位大佬帮帮这个导入kaggle上数据出错的问题
tt1668
2018/10/4镜像同步1 回复
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复