質問編集履歴
1
新しいコードとエラーメッセージを記載いたしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,6 +44,48 @@
|
|
44
44
|
|
45
45
|
|
46
46
|
|
47
|
+
Errorの追記
|
48
|
+
|
49
|
+
--SOM--
|
50
|
+
|
51
|
+
FileNotFoundError Traceback (most recent call last)
|
52
|
+
|
53
|
+
<ipython-input-8-68c047b322c4> in <module>
|
54
|
+
|
55
|
+
2 os.makedirs(f"./data2_group5/{label}", exist_ok=True)
|
56
|
+
|
57
|
+
3 if os.path.isfile(path):
|
58
|
+
|
59
|
+
----> 4 shutil.copyfile(f"./data2/{path.replace(' .jpg', ' ')}", f"./data2_group5/{label}/{path.replace(' .jpg', ' ')}")
|
60
|
+
|
61
|
+
5 print(label, path)
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
/anaconda3/lib/python3.7/shutil.py in copyfile(src, dst, follow_symlinks)
|
66
|
+
|
67
|
+
119 else:
|
68
|
+
|
69
|
+
120 with open(src, 'rb') as fsrc:
|
70
|
+
|
71
|
+
--> 121 with open(dst, 'wb') as fdst:
|
72
|
+
|
73
|
+
122 copyfileobj(fsrc, fdst)
|
74
|
+
|
75
|
+
123 return dst
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
FileNotFoundError: [Errno 2] No such file or directory: './data2_group5/1/1_001.jpg'
|
80
|
+
|
81
|
+
--EOM--
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
47
89
|
```
|
48
90
|
|
49
91
|
|
@@ -55,6 +97,22 @@
|
|
55
97
|
shutil.copyfile(f"./data2/{path.replace(' .jpg', ' ')}", f"./data2_group2/{label}/{path.replace(' .jpg', ' ')}")
|
56
98
|
|
57
99
|
print(label, path)
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
--SOM--
|
104
|
+
|
105
|
+
for label , path in zip(labels, os.listdir('./data2' )) :
|
106
|
+
|
107
|
+
os.makedirs(f"./data2_group5/{label}", exist_ok=True)
|
108
|
+
|
109
|
+
if os.path.isfile(path):
|
110
|
+
|
111
|
+
shutil.copyfile(f"./data2/{path.replace(' .jpg', ' ')}", f"./data2_group5/{label}/{path.replace(' .jpg', ' ')}")
|
112
|
+
|
113
|
+
print(label, path)
|
114
|
+
|
115
|
+
--EOM--
|
58
116
|
|
59
117
|
|
60
118
|
|