質問編集履歴

1

エラーメッセージ追記いたしました。

2020/10/27 16:44

投稿

skjka
skjka

スコア1

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,65 @@
14
14
 
15
15
  ```
16
16
 
17
+ PermissionError Traceback (most recent call last)
18
+
19
+ <ipython-input-12-093ab5cbb48a> in <module>
20
+
21
+ 50 train = allfiles[0:th]
22
+
23
+ 51 test = allfiles[th:]
24
+
25
+ ---> 52 X_train, y_train = make_sample(train)
26
+
27
+ 53 X_test, y_test = make_sample(test)
28
+
29
+ 54 xy = (X_train, X_test, y_train, y_test)
30
+
31
+
32
+
33
+ <ipython-input-12-093ab5cbb48a> in make_sample(files)
34
+
35
+ 23 Y = []
36
+
37
+ 24 for cat, fname in files:
38
+
39
+ ---> 25 add_sample(cat, fname)
40
+
41
+ 26 return np.array(X), np.array(Y)
42
+
43
+ 27
44
+
45
+
46
+
47
+ <ipython-input-12-093ab5cbb48a> in add_sample(cat, fname)
48
+
49
+ 28 #渡された画像データを読み込んでXに格納し、また、画像データに対応するcategoriesのidxをY格納する関数
50
+
51
+ 29 def add_sample(cat, fname):
52
+
53
+ ---> 30 img = Image.open(fname)
54
+
55
+ 31 img = img.convert("RGB")
56
+
57
+ 32 img = img.resize((150, 150))
58
+
59
+
60
+
61
+ c:\users\sern3\appdata\local\programs\python\python36\lib\site-packages\PIL\Image.py in open(fp, mode)
62
+
63
+ 2876
64
+
65
+ 2877 if filename:
66
+
67
+ -> 2878 fp = builtins.open(filename, "rb")
68
+
69
+ 2879 exclusive_fp = True
70
+
71
+ 2880
72
+
73
+
74
+
17
- Permission denied: 'Permission denied: 'C:\Users\sern3\Desktop\petgazou\お茶'
75
+ PermissionError: [Errno 13] Permission denied: 'C:\Users\sern3\Desktop\petgazou\お茶'
18
76
 
19
77
  ```
20
78