質問編集履歴
6
記載ミス
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,7 +92,7 @@
|
|
92
92
|
|
93
93
|
# blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
94
94
|
|
95
|
-
bstream = io.ByteIO()
|
95
|
+
bstream = io.BytesIO()
|
96
96
|
|
97
97
|
file.save(bstream)
|
98
98
|
|
@@ -108,6 +108,6 @@
|
|
108
108
|
|
109
109
|
```
|
110
110
|
|
111
|
-
AttributeError:
|
111
|
+
AttributeError: 'bytes' object has no attribute 'tell'
|
112
112
|
|
113
113
|
```
|
5
記載ミス
test
CHANGED
File without changes
|
test
CHANGED
@@ -108,6 +108,6 @@
|
|
108
108
|
|
109
109
|
```
|
110
110
|
|
111
|
-
|
111
|
+
AttributeError: module 'io' has no attribute 'ByteIO'
|
112
112
|
|
113
113
|
```
|
4
質問の解答
test
CHANGED
File without changes
|
test
CHANGED
@@ -98,7 +98,7 @@
|
|
98
98
|
|
99
99
|
bstream.seek(0)
|
100
100
|
|
101
|
-
blob.upload_from_file(
|
101
|
+
blob.upload_from_file(bstream.read(), content_type=content_type)
|
102
102
|
|
103
103
|
```
|
104
104
|
|
3
質問の解答
test
CHANGED
File without changes
|
test
CHANGED
@@ -74,7 +74,7 @@
|
|
74
74
|
|
75
75
|
### 試したこと
|
76
76
|
|
77
|
-
io.BytesIO(file).read()に変更
|
77
|
+
####io.BytesIO(file).read()に変更
|
78
78
|
|
79
79
|
|
80
80
|
|
@@ -86,7 +86,7 @@
|
|
86
86
|
|
87
87
|
|
88
88
|
|
89
|
-
追加変更
|
89
|
+
####追加変更
|
90
90
|
|
91
91
|
```python
|
92
92
|
|
@@ -101,3 +101,13 @@
|
|
101
101
|
blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
102
102
|
|
103
103
|
```
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
結果
|
108
|
+
|
109
|
+
```
|
110
|
+
|
111
|
+
TypeError: expected str, bytes or os.PathLike object, not NoneType
|
112
|
+
|
113
|
+
```
|
2
質問の解答
test
CHANGED
File without changes
|
test
CHANGED
@@ -83,3 +83,21 @@
|
|
83
83
|
TypeError: a bytes-like object is required, not 'FileStorage'
|
84
84
|
|
85
85
|
```
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
追加変更
|
90
|
+
|
91
|
+
```python
|
92
|
+
|
93
|
+
# blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
94
|
+
|
95
|
+
bstream = io.ByteIO()
|
96
|
+
|
97
|
+
file.save(bstream)
|
98
|
+
|
99
|
+
bstream.seek(0)
|
100
|
+
|
101
|
+
blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
102
|
+
|
103
|
+
```
|
1
質問の解答
test
CHANGED
File without changes
|
test
CHANGED
@@ -69,3 +69,17 @@
|
|
69
69
|
return blob.public_url
|
70
70
|
|
71
71
|
```
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
### 試したこと
|
76
|
+
|
77
|
+
io.BytesIO(file).read()に変更
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
```
|
82
|
+
|
83
|
+
TypeError: a bytes-like object is required, not 'FileStorage'
|
84
|
+
|
85
|
+
```
|