|
|||
NRAO Home > CASA > CASA Cookbook and User Reference Manual |
|
B.7.1 Using the os.system methods
To use this, you need the os package. This should be loaded by default by casapy, but if not you can use
in your script.
For example, in our scripts we use this to clean up any existing output files
prefix=’ngc5921.usecase’
# Clean up old files
os.system(’rm -rf ’+prefix+’*’)
Note that the os package has many useful methods. You can see these by using tab-completion:
os.EX_CANTCREAT os._Environ os.fdatasync os.remove
os.EX_CONFIG os.__all__ os.fdopen os.removedirs
os.EX_DATAERR os.__builtins__ os.fork os.rename
os.EX_IOERR os.__class__ os.forkpty os.renames
os.EX_NOHOST os.__delattr__ os.fpathconf os.rmdir
os.EX_NOINPUT os.__dict__ os.fstat os.sep
os.EX_NOPERM os.__doc__ os.fstatvfs os.setegid
os.EX_NOUSER os.__file__ os.fsync os.seteuid
os.EX_OK os.__getattribute__ os.ftruncate os.setgid
os.EX_OSERR os.__hash__ os.getcwd os.setgroups
os.EX_OSFILE os.__init__ os.getcwdu os.setpgid
os.EX_PROTOCOL os.__name__ os.getegid os.setpgrp
os.EX_SOFTWARE os.__new__ os.getenv os.setregid
os.EX_TEMPFAIL os.__reduce__ os.geteuid os.setreuid
os.EX_UNAVAILABLE os.__reduce_ex__ os.getgid os.setsid
os.EX_USAGE os.__repr__ os.getgroups os.setuid
os.F_OK os.__setattr__ os.getloadavg os.spawnl
os.NGROUPS_MAX os.__str__ os.getlogin os.spawnle
os.O_APPEND os._copy_reg os.getpgid os.spawnlp
os.O_CREAT os._execvpe os.getpgrp os.spawnlpe
os.O_DIRECT os._exists os.getpid os.spawnv
os.O_DIRECTORY os._exit os.getppid os.spawnve
os.O_DSYNC os._get_exports_list os.getsid os.spawnvp
os.O_EXCL os._make_stat_result os.getuid os.spawnvpe
os.O_LARGEFILE os._make_statvfs_result os.isatty os.stat
os.O_NDELAY os._pickle_stat_result os.kill os.stat_float_times
os.O_NOCTTY os._pickle_statvfs_result os.killpg os.stat_result
os.O_NOFOLLOW os._spawnvef os.lchown os.statvfs
os.O_NONBLOCK os.abort os.linesep os.statvfs_result
os.O_RDONLY os.access os.link os.strerror
os.O_RDWR os.altsep os.listdir os.symlink
os.O_RSYNC os.chdir os.lseek os.sys
os.O_SYNC os.chmod os.lstat os.sysconf
os.O_TRUNC os.chown os.major os.sysconf_names
os.O_WRONLY os.chroot os.makedev os.system
os.P_NOWAIT os.close os.makedirs os.tcgetpgrp
os.P_NOWAITO os.confstr os.minor os.tcsetpgrp
os.P_WAIT os.confstr_names os.mkdir os.tempnam
os.R_OK os.ctermid os.mkfifo os.times
os.SEEK_CUR os.curdir os.mknod os.tmpfile
os.SEEK_END os.defpath os.name os.tmpnam
os.SEEK_SET os.devnull os.nice os.ttyname
os.TMP_MAX os.dup os.open os.umask
os.UserDict os.dup2 os.openpty os.uname
os.WCONTINUED os.environ os.pardir os.unlink
os.WCOREDUMP os.errno os.path os.unsetenv
os.WEXITSTATUS os.error os.pathconf os.urandom
os.WIFCONTINUED os.execl os.pathconf_names os.utime
os.WIFEXITED os.execle os.pathsep os.wait
os.WIFSIGNALED os.execlp os.pipe os.wait3
os.WIFSTOPPED os.execlpe os.popen os.wait4
os.WNOHANG os.execv os.popen2 os.waitpid
os.WSTOPSIG os.execve os.popen3 os.walk
os.WTERMSIG os.execvp os.popen4 os.write
os.WUNTRACED os.execvpe os.putenv
os.W_OK os.extsep os.read
os.X_OK os.fchdir os.readlink
More information about CASA may be found at the
CASA web page
Copyright © 2010 Associated Universities Inc., Washington, D.C.
This code is available under the terms of the GNU General Public Lincense
Home |
Contact Us |
Directories |
Site Map |
Help |
Privacy Policy |
Search