teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

追記

2018/11/07 13:14

投稿

BURI55
BURI55

スコア25

title CHANGED
File without changes
body CHANGED
@@ -155,4 +155,24 @@
155
155
  IndexError: list index out of range
156
156
 
157
157
  C:\Users\user\Desktop\nicolive-mastodon-1.1.2>
158
+ ```
159
+ この辺のxml生成があやしいのですがよくわかりません。
160
+ ```python
161
+ def on_update(self, toot):
162
+ comment = self.make_comment(toot)
163
+ if comment is None:
164
+ return
165
+
166
+ # execute command
167
+ for f in self.config.execute_command:
168
+ subprocess.run(construct_execute_command(f, comment).split(' '))
169
+
170
+ # get last number of xml
171
+ tree = ET.parse(self.path_xml)
172
+ root_xml = tree.getroot()
173
+ element = self.make_xml_element(root_xml, comment)
174
+
175
+ # add xml
176
+ root_xml.append(element)
177
+ tree.write(self.path_xml, encoding='utf-8')
158
178
  ```

1

タイトル編集

2018/11/07 13:14

投稿

BURI55
BURI55

スコア25

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