答えを探しましたが、これまでのところ何も役に立ちませんでした。odt ファイルを作成してテキストを入力するために使用したいメソッドがあります。また、ファイルが作成されたときにユーザーがファイルを表示できるようにします。私はpython 3.4.3 unotools 0.3.3 LinuxMint 17.1 LibreOffice 4.2.8.2を使用しています
問題:
unotools.errors.ConnectionError: failed to connect: ('socket,host=localhost,port=8100', {})
unotools サンプルは端末から正常に動作しました - sample.odt を作成してエラーなしで保存しました。私のドラフトコード:
def writer_report(self):
subprocess.Popen(["soffice", "--accept='socket,host=localhost,port=8100;urp;StarOffice.Service'"])
time.sleep(5) # using this to give time for LibreOffice to open - temporary
context = connect(Socket('localhost', '8100'))
writer = Writer(context)
writer.set_string_to_end('world\n')
writer.set_string_to_start('hello\n')
writer.store_to_url('output.odt','FilterName','writer8')
writer.close(True)
LibreOffice アプリケーションが開き、開いたままになります。ただし、接続は失われているようです。
誰かが私を助けてくれることを願っています、ありがとう。