system calls from wxPython . . .

Just as I was using the system() function in the Gtk+ to invoke the system, here too I needed a function for invoking the system calls.
“GOOGLE !!!”

I obviously, had to look into atleast 20 to 30 documents to understand clearly the system call functions and decide on which will suit my work.

I learnt that the os.popen() function has been deprecated after the python2.4 .
Note: to use the above function we need to import the os module.
Sample code:

import os

Note: the above command will give the list of files in the current directory, BUT we can not have it as ls -l !!! in order to do so, keep the command in a variable and then call it in the popen() function.

Another way is to import the subprocess module.The subprocess is widely used now since it came only after the python2.4 version.
A sample code:

import subprocess


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s