質問編集履歴

2

追記

2018/11/07 13:14

投稿

BURI55
BURI55

スコア25

test CHANGED
File without changes
test CHANGED
@@ -313,3 +313,43 @@
313
313
  C:\Users\user\Desktop\nicolive-mastodon-1.1.2>
314
314
 
315
315
  ```
316
+
317
+ この辺のxml生成があやしいのですがよくわかりません。
318
+
319
+ ```python
320
+
321
+ def on_update(self, toot):
322
+
323
+ comment = self.make_comment(toot)
324
+
325
+ if comment is None:
326
+
327
+ return
328
+
329
+
330
+
331
+ # execute command
332
+
333
+ for f in self.config.execute_command:
334
+
335
+ subprocess.run(construct_execute_command(f, comment).split(' '))
336
+
337
+
338
+
339
+ # get last number of xml
340
+
341
+ tree = ET.parse(self.path_xml)
342
+
343
+ root_xml = tree.getroot()
344
+
345
+ element = self.make_xml_element(root_xml, comment)
346
+
347
+
348
+
349
+ # add xml
350
+
351
+ root_xml.append(element)
352
+
353
+ tree.write(self.path_xml, encoding='utf-8')
354
+
355
+ ```

1

タイトル編集

2018/11/07 13:14

投稿

BURI55
BURI55

スコア25

test CHANGED
@@ -1 +1 @@
1
- Pythonでマストドンからテキストデータを引き出して、外部プログラムに渡して読み上げするプログラムを作っています。一つ読んだ後インデックスエラーで止まってしまいます。
1
+ Pythonでマストドン読み上げするプログラムを作っています。一つ読んだ後インデックスエラーで止まってしまいます。回避方法はどうしたらよいでしょうか?
test CHANGED
File without changes