[Tutor] Open a libreoffice calc file in Python

boB Stepp robertvstepp at gmail.com
Wed Dec 21 22:54:37 EST 2016


On Wed, Dec 21, 2016 at 9:37 PM, Jim Byrnes <jf_byrnes at comcast.net> wrote:
> Python 3.4 on Ubuntu
>
> If I was going to open a libreoffice calc file from the terminal I would go:
> libreoffice --calc /home/path/to/myfile.ods.
>
> How would I do this from Python?

My first thought was:

import os

os.system(insert_your_command)

But looking at the documentation
(https://docs.python.org/3/library/os.html#os.system) it says it is
preferable to use the subprocess module with documentation here:
https://docs.python.org/3/library/subprocess.html#replacing-os-system

It makes me wonder if I should go back and revisit some code I wrote
as I used the os.system()approach.  But was this option available in
Py 2.4.4?  I'll have to check.


-- 
boB


More information about the Tutor mailing list