質問編集履歴

3

エラーの内容を更新しました。

2019/10/18 08:01

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,12 @@
7
7
  ##困っていること
8
8
 
9
9
  ↓のプログラムコードを実行すると、次のエラーがでてしまいます。
10
+
11
+
12
+
13
+ **エラー①**
14
+
15
+ jsonファイルの文字コードがShift-JISの時に発生していたエラー
10
16
 
11
17
  ```html
12
18
 
@@ -60,7 +66,45 @@
60
66
 
61
67
  ```
62
68
 
69
+
70
+
71
+ **エラー②**
72
+
63
- エラーの原因つい教えてくださ
73
+ jsonファイルの文字コドがUTF-8発生していたエラー
74
+
75
+ ```html
76
+
77
+ Traceback (most recent call last):
78
+
79
+ File "./GDVTest.py", line 16, in <module>
80
+
81
+ credentials = ServiceAccountCredentials.from_json_keyfile_name('My Project BME280-3702d030ad2e.json', scope)
82
+
83
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/service_account.py", line 220, in from_json_keyfile_name
84
+
85
+ client_credentials = json.load(file_obj)
86
+
87
+ File "/usr/lib/python2.7/json/__init__.py", line 291, in load
88
+
89
+ **kw)
90
+
91
+ File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
92
+
93
+ return _default_decoder.decode(s)
94
+
95
+ File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
96
+
97
+ obj, end = self.raw_decode(s, idx=_w(s, 0).end())
98
+
99
+ File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
100
+
101
+ raise ValueError("No JSON object could be decoded")
102
+
103
+ ValueError: No JSON object could be decoded
104
+
105
+ ```
106
+
107
+
64
108
 
65
109
 
66
110
 

2

エラー内容の更新をしました。

2019/10/18 08:00

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -32,39 +32,31 @@
32
32
 
33
33
  self._do_refresh_request(http)
34
34
 
35
- File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/client.py", line 774, in _do_refresh_request
35
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/client.py", line 780, in _do_refresh_request
36
36
 
37
- body = self._generate_refresh_request_body()
37
+ body=body, headers=headers)
38
38
 
39
- File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/client.py", line 1484, in _generate_refresh_request_body
39
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/transport.py", line 282, in request
40
40
 
41
- assertion = self._generate_assertion()
41
+ connection_type=connection_type)
42
42
 
43
- File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/service_account.py", line 385, in _generate_assertion
43
+ File "/home/pi/.local/lib/python2.7/site-packages/httplib2/__init__.py", line 2135, in request
44
44
 
45
- key_id=self._private_key_id)
45
+ cachekey,
46
46
 
47
- File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/crypt.py", line 97, in make_signed_jwt
47
+ File "/home/pi/.local/lib/python2.7/site-packages/httplib2/__init__.py", line 1796, in _request
48
48
 
49
- signature = signer.sign(signing_input)
49
+ conn, request_uri, method, body, headers
50
50
 
51
- File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/_openssl_crypt.py", line 97, in sign
51
+ File "/home/pi/.local/lib/python2.7/site-packages/httplib2/__init__.py", line 1701, in _conn_request
52
52
 
53
- return crypto.sign(self._key, message, 'sha256')
53
+ conn.connect()
54
54
 
55
- File "/usr/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 2670, in sign
55
+ File "/home/pi/.local/lib/python2.7/site-packages/httplib2/__init__.py", line 1411, in connect
56
56
 
57
- _openssl_assert(final_result == 1)
57
+ raise SSLHandshakeError(e)
58
58
 
59
- File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 61, in openssl_assert
60
-
61
- exception_from_error_queue(error)
62
-
63
- File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 48, in exception_from_error_queue
64
-
65
- raise exception_type(errors)
66
-
67
- OpenSSL.crypto.Error: [('', 'osrandom_rand_bytes', 'getrandom() initialization failed.'), ('rsa routines', 'RSA_setup_blinding', 'BN lib'), ('rsa routines', 'rsa_ossl_private_encrypt', 'internal error')]
59
+ httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
68
60
 
69
61
  ```
70
62
 

1

エラー内容を修正しました。

2019/10/18 01:59

投稿

raspypy
raspypy

スコア247

test CHANGED
File without changes
test CHANGED
@@ -10,17 +10,61 @@
10
10
 
11
11
  ```html
12
12
 
13
- ./GDVTest.py: 1: import: コマンドが見つかりません
13
+ Traceback (most recent call last):
14
14
 
15
- ./GDVTest.py: 2: import: コマンドが見つかりません
15
+ File "./GDVTest.py", line 18, in <module>
16
16
 
17
- from: can't read /var/mail/oauth2client.service_account
17
+ gc = gspread.authorize(credentials)
18
18
 
19
- ./GDVTest.py: 8: scope: コマンドが見つかりません
19
+ File "/home/pi/.local/lib/python2.7/site-packages/gspread/__init__.py", line 38, in authorize
20
20
 
21
- ./GDVTest.py: 12: 予期しないトークン `(' 周辺に構文エラーがあります
21
+ client.login()
22
22
 
23
- ./GDVTest.py: 12: `credentials = ServiceAccountCredentials.from_json_keyfile_name('xxx.json', scope)'
23
+ File "/home/pi/.local/lib/python2.7/site-packages/gspread/client.py", line 51, in login
24
+
25
+ self.auth.refresh(http)
26
+
27
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/client.py", line 545, in refresh
28
+
29
+ self._refresh(http)
30
+
31
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/client.py", line 749, in _refresh
32
+
33
+ self._do_refresh_request(http)
34
+
35
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/client.py", line 774, in _do_refresh_request
36
+
37
+ body = self._generate_refresh_request_body()
38
+
39
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/client.py", line 1484, in _generate_refresh_request_body
40
+
41
+ assertion = self._generate_assertion()
42
+
43
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/service_account.py", line 385, in _generate_assertion
44
+
45
+ key_id=self._private_key_id)
46
+
47
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/crypt.py", line 97, in make_signed_jwt
48
+
49
+ signature = signer.sign(signing_input)
50
+
51
+ File "/home/pi/.local/lib/python2.7/site-packages/oauth2client/_openssl_crypt.py", line 97, in sign
52
+
53
+ return crypto.sign(self._key, message, 'sha256')
54
+
55
+ File "/usr/lib/python2.7/dist-packages/OpenSSL/crypto.py", line 2670, in sign
56
+
57
+ _openssl_assert(final_result == 1)
58
+
59
+ File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 61, in openssl_assert
60
+
61
+ exception_from_error_queue(error)
62
+
63
+ File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 48, in exception_from_error_queue
64
+
65
+ raise exception_type(errors)
66
+
67
+ OpenSSL.crypto.Error: [('', 'osrandom_rand_bytes', 'getrandom() initialization failed.'), ('rsa routines', 'RSA_setup_blinding', 'BN lib'), ('rsa routines', 'rsa_ossl_private_encrypt', 'internal error')]
24
68
 
25
69
  ```
26
70