質問編集履歴
6
記載ミス
title
CHANGED
File without changes
|
body
CHANGED
@@ -45,7 +45,7 @@
|
|
45
45
|
####追加変更
|
46
46
|
```python
|
47
47
|
# blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
48
|
-
bstream = io.
|
48
|
+
bstream = io.BytesIO()
|
49
49
|
file.save(bstream)
|
50
50
|
bstream.seek(0)
|
51
51
|
blob.upload_from_file(bstream.read(), content_type=content_type)
|
@@ -53,5 +53,5 @@
|
|
53
53
|
|
54
54
|
結果
|
55
55
|
```
|
56
|
-
AttributeError:
|
56
|
+
AttributeError: 'bytes' object has no attribute 'tell'
|
57
57
|
```
|
5
記載ミス
title
CHANGED
File without changes
|
body
CHANGED
@@ -53,5 +53,5 @@
|
|
53
53
|
|
54
54
|
結果
|
55
55
|
```
|
56
|
-
|
56
|
+
AttributeError: module 'io' has no attribute 'ByteIO'
|
57
57
|
```
|
4
質問の解答
title
CHANGED
File without changes
|
body
CHANGED
@@ -48,7 +48,7 @@
|
|
48
48
|
bstream = io.ByteIO()
|
49
49
|
file.save(bstream)
|
50
50
|
bstream.seek(0)
|
51
|
-
blob.upload_from_file(
|
51
|
+
blob.upload_from_file(bstream.read(), content_type=content_type)
|
52
52
|
```
|
53
53
|
|
54
54
|
結果
|
3
質問の解答
title
CHANGED
File without changes
|
body
CHANGED
@@ -36,17 +36,22 @@
|
|
36
36
|
```
|
37
37
|
|
38
38
|
### 試したこと
|
39
|
-
io.BytesIO(file).read()に変更
|
39
|
+
####io.BytesIO(file).read()に変更
|
40
40
|
|
41
41
|
```
|
42
42
|
TypeError: a bytes-like object is required, not 'FileStorage'
|
43
43
|
```
|
44
44
|
|
45
|
-
追加変更
|
45
|
+
####追加変更
|
46
46
|
```python
|
47
47
|
# blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
48
48
|
bstream = io.ByteIO()
|
49
49
|
file.save(bstream)
|
50
50
|
bstream.seek(0)
|
51
51
|
blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
52
|
+
```
|
53
|
+
|
54
|
+
結果
|
55
|
+
```
|
56
|
+
TypeError: expected str, bytes or os.PathLike object, not NoneType
|
52
57
|
```
|
2
質問の解答
title
CHANGED
File without changes
|
body
CHANGED
@@ -40,4 +40,13 @@
|
|
40
40
|
|
41
41
|
```
|
42
42
|
TypeError: a bytes-like object is required, not 'FileStorage'
|
43
|
+
```
|
44
|
+
|
45
|
+
追加変更
|
46
|
+
```python
|
47
|
+
# blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
48
|
+
bstream = io.ByteIO()
|
49
|
+
file.save(bstream)
|
50
|
+
bstream.seek(0)
|
51
|
+
blob.upload_from_file(io.BytesIO(file).read(), content_type=content_type)
|
43
52
|
```
|
1
質問の解答
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,4 +33,11 @@
|
|
33
33
|
blob.upload_from_file(file.read(), content_type=content_type)
|
34
34
|
blob.make_public()
|
35
35
|
return blob.public_url
|
36
|
+
```
|
37
|
+
|
38
|
+
### 試したこと
|
39
|
+
io.BytesIO(file).read()に変更
|
40
|
+
|
41
|
+
```
|
42
|
+
TypeError: a bytes-like object is required, not 'FileStorage'
|
36
43
|
```
|