teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

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

2020/10/27 16:44

投稿

skjka
skjka

スコア1

title CHANGED
File without changes
body CHANGED
@@ -6,7 +6,36 @@
6
6
  ### 発生している問題・エラーメッセージ
7
7
 
8
8
  ```
9
+ PermissionError Traceback (most recent call last)
10
+ <ipython-input-12-093ab5cbb48a> in <module>
11
+ 50 train = allfiles[0:th]
12
+ 51 test = allfiles[th:]
13
+ ---> 52 X_train, y_train = make_sample(train)
14
+ 53 X_test, y_test = make_sample(test)
15
+ 54 xy = (X_train, X_test, y_train, y_test)
16
+
17
+ <ipython-input-12-093ab5cbb48a> in make_sample(files)
18
+ 23 Y = []
19
+ 24 for cat, fname in files:
20
+ ---> 25 add_sample(cat, fname)
21
+ 26 return np.array(X), np.array(Y)
22
+ 27
23
+
24
+ <ipython-input-12-093ab5cbb48a> in add_sample(cat, fname)
25
+ 28 #渡された画像データを読み込んでXに格納し、また、画像データに対応するcategoriesのidxをY格納する関数
26
+ 29 def add_sample(cat, fname):
27
+ ---> 30 img = Image.open(fname)
28
+ 31 img = img.convert("RGB")
29
+ 32 img = img.resize((150, 150))
30
+
31
+ c:\users\sern3\appdata\local\programs\python\python36\lib\site-packages\PIL\Image.py in open(fp, mode)
32
+ 2876
33
+ 2877 if filename:
34
+ -> 2878 fp = builtins.open(filename, "rb")
35
+ 2879 exclusive_fp = True
36
+ 2880
37
+
9
- Permission denied: 'Permission denied: 'C:\Users\sern3\Desktop\petgazou\お茶'
38
+ PermissionError: [Errno 13] Permission denied: 'C:\Users\sern3\Desktop\petgazou\お茶'
10
39
  ```
11
40
 
12
41
  ### 該当のソースコード