質問編集履歴

1

回答を受けての内容補足

2020/07/10 10:23

投稿

branch
branch

スコア70

test CHANGED
File without changes
test CHANGED
@@ -201,3 +201,103 @@
201
201
  一行前で宣言してるやんけ,,,とサッパリでして,ここに時間を割くよりは細かい仕様変更に時間を費やしたいと思い投稿いたしました.
202
202
 
203
203
  初歩的な内容かと思いますが,何卒よろしくお願い申し上げます.
204
+
205
+
206
+
207
+ ###補足
208
+
209
+ aokikenichi様,のご回答を受けて`array.extend([ori_text, translation.text])`をif分岐の前に移動し,実行したところ下記のエラーが出ました.
210
+
211
+ ```
212
+
213
+ %USERPROFILE%>%USERPROFILE%/AppData/Local/Programs/Python/Python38/python.exe %USERPROFILE%/Desktop/develop/Auto-Translate/translate.py
214
+
215
+ 829
216
+
217
+ Traceback (most recent call last):
218
+
219
+ File "%USERPROFILE%/Desktop/develop/Auto-Translate/translate.py", line 53, in <module>
220
+
221
+ main()
222
+
223
+ File "%USERPROFILE%/Desktop/develop/Auto-Translate/translate.py", line 20, in main
224
+
225
+ GetTranslation(Application, Filepath[k-1] , Filename[k-1] , folder)
226
+
227
+ File "%USERPROFILE%/Desktop/develop/Auto-Translate/translate.py", line 34, in GetTranslation
228
+
229
+ translation = translator.translate(ori_text, dest='en')
230
+
231
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\googletrans\client.py", line 182, in translate
232
+
233
+ data = self._translate(text, dest, src, kwargs)
234
+
235
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\googletrans\client.py", line 78, in _translate
236
+
237
+ token = self.token_acquirer.do(text)
238
+
239
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\googletrans\gtoken.py", line 194, in do
240
+
241
+ self._update()
242
+
243
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\googletrans\gtoken.py", line 54, in _update
244
+
245
+ r = self.client.get(self.host)
246
+
247
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 755, in get
248
+
249
+ return self.request(
250
+
251
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 600, in request
252
+
253
+ return self.send(
254
+
255
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 620, in send
256
+
257
+ response = self.send_handling_redirects(
258
+
259
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 647, in send_handling_redirects
260
+
261
+ response = self.send_handling_auth(
262
+
263
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 684, in send_handling_auth
264
+
265
+ response = self.send_single_request(request, timeout)
266
+
267
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpx\_client.py", line 714, in send_single_request
268
+
269
+ ) = transport.request(
270
+
271
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\http_proxy.py", line 110, in request
272
+
273
+ return self._tunnel_request(
274
+
275
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\http_proxy.py", line 191, in _tunnel_request
276
+
277
+ proxy_response = proxy_connection.request(
278
+
279
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\connection.py", line 65, in request
280
+
281
+ self.socket = self._open_socket(timeout)
282
+
283
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_sync\connection.py", line 85, in _open_socket
284
+
285
+ return self.backend.open_tcp_stream(
286
+
287
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_backends\sync.py", line 139, in open_tcp_stream
288
+
289
+ return SyncSocketStream(sock=sock)
290
+
291
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\contextlib.py", line 131, in __exit__
292
+
293
+ self.gen.throw(type, value, traceback)
294
+
295
+ File "%USERPROFILE%\AppData\Local\Programs\Python\Python38\lib\site-packages\httpcore\_exceptions.py", line 12, in map_exceptions
296
+
297
+ raise to_exc(exc) from None
298
+
299
+ httpcore._exceptions.ConnectError: [Errno 0] Error
300
+
301
+ ```
302
+
303
+ 社用PCのプロキシ設定によるエラーでしょうか..?