[Tutor] Open a libreoffice calc file in Python

eryk sun eryksun at gmail.com
Thu Dec 22 01:20:40 EST 2016


On Thu, Dec 22, 2016 at 4:50 AM,  <cs at zip.com.au> wrote:
> BTW, the array form is Popen's default mode; sensibly you need to _ask_ to
> use a shell string with shell=True, because that is harder and more fragile.

Without shell=True, args as a string on POSIX is generally an error
because it will look for the entire string as the executable. The
exception is if the string has no command-line arguments (e.g.
Popen('ls')).

On Windows it's always acceptable to pass args as a string. For a
complex command line it may be easier to pass args as a list and let
Popen call list2cmdline to create a string that's properly quoted and
escaped. Here 'properly' assumes the target executable parses its
command line using VC++ rules. It may use custom rules, in which case
you have to pass args as a string.


More information about the Tutor mailing list