Imaris Open - Discussion Forum

This is a community discussion space where Imaris is the key topic. This forum will offer guidance to new users, technical as well as application support. Users from sites with a valid Imaris Infinity subscription will receive priority – however, the fastest way to get to the Bitplane Technical and Application Support team will continue to be via Asia, EU or US support mailboxes. Every registered user can add items to the forum. Non-registered users can read the forum but cannot add/comment, etc. All ideas, questions, suggestions and comments are welcome.

Advanced Search
Thread Author
Max. Age of Thread
Number of Posts
Thread Rating
HomeHomeXTensionsXTensionsPythonPythonCalling an external command in PythonCalling an external command in Python
New Post
Calling an external command in Python
 
How can I call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?  

https://www.python.org/' target='_blank'>www.python.org/






 
Copy Post URL
douglassirkshaun wrote:
How can I call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?  

https://www.python.org/' target='_blank'>www.python.org/






Mon, 30 Jan 2017 14:12:46 GMT

 

Look at the subprocess module in the standard library:

from subprocess import call call(["ls", "-l"])

The advantage of subprocess vs system is that it is more flexible (you can get the stdout, stderr, the "real" status code, better error handling, etc...).

The official docs recommend the subprocess module over the alternative os.system():

The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function [os.system()].

The "Replacing Older Functions with the subprocess Module" section in the subprocessdocumentation may have some helpful recipes.

Official documentation on the subprocess module:

 
Copy Post URL


Post URL:
casque beats pas cher casque beats by dre pas cher beats by dre pas cher beats by dre pas cher maillot foot pas cher maillot de foot pas cher maillot foot pas cher 2014 maillot de foot pas cher maillot foot pas cher maillot de foot pas cher maillot foot pas cher 2014 maillot de foot pas cher maillot foot pas cher 2014 maillot de foot pas chere maillot foot pas cher maillot de foot pas cher Ralph Lauren Homme Polo Manche Longue Ralph Lauren Polo Ralph Lauren Pas Cher Homme Polo Ralph Lauren Homme Pas Cher Ralph Lauren Soldes Ralph Lauren Big Pony Ralph Lauren Soldes Ralph Lauren Big Pony Ralph Lauren Soldes Ralph Lauren Big Pony Ralph Lauren Soldes Ralph Lauren Big Pony