質問編集履歴
3
Traceback追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,11 +58,23 @@
|
|
58
58
|
|
59
59
|
|
60
60
|
|
61
|
+
Traceback (most recent call last):
|
62
|
+
|
63
|
+
File "/var/www/flaskr/view/test.py", line 10, in upload
|
64
|
+
|
65
|
+
_file.save(_filePath)
|
66
|
+
|
67
|
+
File "/usr/lib/python3.6/site-packages/werkzeug/datastructures.py", line 2725, in save
|
68
|
+
|
69
|
+
dst = open(dst, 'wb')
|
70
|
+
|
71
|
+
UnicodeEncodeError: 'ascii' codec can't encode characters in position 41-44: ordinal not in range(128)
|
72
|
+
|
61
73
|
|
62
74
|
|
63
75
|
追記しました。
|
64
76
|
|
65
|
-
エラーのtraceback
|
77
|
+
エラーのtracebackを出力したので追記してます。
|
66
78
|
|
67
79
|
サーバの環境はAWSのCENTOSになります。
|
68
80
|
|
2
HTML追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,27 +2,33 @@
|
|
2
2
|
|
3
3
|
ascii' codec can't encode characters in position・・・とエラーが発生します。
|
4
4
|
|
5
|
+
```html
|
5
6
|
|
7
|
+
<input id="file" name="file" type="file">
|
8
|
+
|
9
|
+
```
|
6
10
|
|
7
11
|
```Python
|
8
12
|
|
9
|
-
|
13
|
+
@app.route('/upload', methods=['POST'])
|
10
14
|
|
15
|
+
def upload():
|
16
|
+
|
11
|
-
|
17
|
+
file = request.files['file']
|
12
18
|
|
13
19
|
|
14
20
|
|
15
|
-
_rootpath = '/tmp/'
|
21
|
+
_rootpath = '/tmp/'
|
16
22
|
|
17
|
-
_filePath = os.path.join(_rootpath , 'メンバー.csv')
|
23
|
+
_filePath = os.path.join(_rootpath , 'メンバー.csv')
|
18
24
|
|
19
|
-
try:
|
25
|
+
try:
|
20
26
|
|
21
|
-
_file.save(_filePath)
|
27
|
+
_file.save(_filePath)
|
22
28
|
|
23
|
-
except Exception as _e:
|
29
|
+
except Exception as _e:
|
24
30
|
|
25
|
-
print(_e)
|
31
|
+
print(_e)
|
26
32
|
|
27
33
|
```
|
28
34
|
|
1
不足ソースの追加、サーバ環境を追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,15 @@
|
|
6
6
|
|
7
7
|
```Python
|
8
8
|
|
9
|
+
file = request.files['file']
|
10
|
+
|
11
|
+
(<FileStorage: 'メンバー.csv' ('application/vnd.ms-excel')>)
|
12
|
+
|
13
|
+
|
14
|
+
|
9
|
-
_
|
15
|
+
_rootpath = '/tmp/'
|
16
|
+
|
17
|
+
_filePath = os.path.join(_rootpath , 'メンバー.csv')
|
10
18
|
|
11
19
|
try:
|
12
20
|
|
@@ -41,3 +49,25 @@
|
|
41
49
|
|
42
50
|
|
43
51
|
どのような対応が必要かわかる方、教えていただけると助かります。
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
追記しました。
|
58
|
+
|
59
|
+
エラーのtracebackは出力できておらず取得できてません。
|
60
|
+
|
61
|
+
サーバの環境はAWSのCENTOSになります。
|
62
|
+
|
63
|
+
環境変数のLANGは「ja_JP.utf8」になっています。
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
```
|