Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
os Namespace Reference

Data Structures

class  _Environ
 

Functions

def makedirs
 
def removedirs
 
def renames
 
def execl
 
def execle
 
def execlp
 
def execlpe
 
def execvp
 
def execvpe
 
def unsetenv
 
def getenv
 
def spawnv
 
def spawnve
 
def spawnvp
 
def spawnvpe
 
def spawnl
 
def spawnle
 
def spawnlp
 
def spawnlpe
 
def popen2
 
def popen3
 
def popen4
 

Variables

 _names = sys.builtin_module_names
 
 altsep = None
 
list __all__
 
string name = 'posix'
 
string linesep = '\n'
 
string curdir = '.'
 
string defpath = ':/bin:/usr/bin'
 
 path = posixpath
 
string extsep = '/'
 
dictionary environ = {}
 
 _notfound = None
 
int P_WAIT = 0
 
int P_NOWAIT = 1
 

Function Documentation

def os.execl (   file,
  args 
)
execl(file, *args)

Execute the executable file with argument list args, replacing the
current process. 

Definition at line 261 of file os.py.

262 def execl(file, *args):
263  """execl(file, *args)
264 
265  Execute the executable file with argument list args, replacing the
266  current process. """
267  execv(file, args)
def os.execle (   file,
  args 
)
execle(file, *args, env)

Execute the executable file with argument list args and
environment env, replacing the current process. 

Definition at line 268 of file os.py.

269 def execle(file, *args):
270  """execle(file, *args, env)
271 
272  Execute the executable file with argument list args and
273  environment env, replacing the current process. """
274  env = args[-1]
275  execve(file, args[:-1], env)
def os.execlp (   file,
  args 
)
execlp(file, *args)

Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process. 

Definition at line 276 of file os.py.

References execvp().

277 def execlp(file, *args):
278  """execlp(file, *args)
279 
280  Execute the executable file (which is searched for along $PATH)
281  with argument list args, replacing the current process. """
282  execvp(file, args)
def os.execlpe (   file,
  args 
)
execlpe(file, *args, env)

Execute the executable file (which is searched for along $PATH)
with argument list args and environment env, replacing the current
process. 

Definition at line 283 of file os.py.

References execvpe().

284 def execlpe(file, *args):
285  """execlpe(file, *args, env)
286 
287  Execute the executable file (which is searched for along $PATH)
288  with argument list args and environment env, replacing the current
289  process. """
290  env = args[-1]
291  execvpe(file, args[:-1], env)
def os.execvp (   file,
  args 
)
execp(file, args)

Execute the executable file (which is searched for along $PATH)
with argument list args, replacing the current process.
args may be a list or tuple of strings. 

Definition at line 292 of file os.py.

293 def execvp(file, args):
294  """execp(file, args)
295 
296  Execute the executable file (which is searched for along $PATH)
297  with argument list args, replacing the current process.
298  args may be a list or tuple of strings. """
299  _execvpe(file, args)
def os.execvpe (   file,
  args,
  env 
)
execv(file, args, env)

Execute the executable file (which is searched for along $PATH)
with argument list args and environment env , replacing the
current process.
args may be a list or tuple of strings. 

Definition at line 300 of file os.py.

301 def execvpe(file, args, env):
302  """execv(file, args, env)
303 
304  Execute the executable file (which is searched for along $PATH)
305  with argument list args and environment env , replacing the
306  current process.
307  args may be a list or tuple of strings. """
308  _execvpe(file, args, env)
309 
310 __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
def os.getenv (   key,
  default = None 
)
Get an environment variable, return None if it doesn't exist.
The optional second argument can specify an alternate default.

Definition at line 428 of file os.py.

429  def getenv(key, default=None):
430  """Get an environment variable, return None if it doesn't exist.
431  The optional second argument can specify an alternate default."""
return environ.get(key, default)
def os.makedirs (   name,
  mode = 0777 
)
makedirs(path [, mode=0777]) -> None

Super-mkdir; create a leaf directory and all intermediate ones.
Works like mkdir, except that any intermediate path segment (not
just the rightmost) will be created if it does not exist.  This is
recursive.

Definition at line 189 of file os.py.

190 def makedirs(name, mode=0777):
191  """makedirs(path [, mode=0777]) -> None
192 
193  Super-mkdir; create a leaf directory and all intermediate ones.
194  Works like mkdir, except that any intermediate path segment (not
195  just the rightmost) will be created if it does not exist. This is
196  recursive.
197 
198  """
199  head, tail = path.split(name)
200  if not tail:
201  head, tail = path.split(head)
202  if head and tail and not path.exists(head):
203  makedirs(head, mode)
204  mkdir(name, mode)
def os.popen2 (   cmd,
  mode = "t",
  bufsize = -1 
)

Definition at line 575 of file os.py.

References popen2.popen2().

576  def popen2(cmd, mode="t", bufsize=-1):
577  import popen2
578  stdout, stdin = popen2.popen2(cmd, bufsize)
return stdin, stdout
def os.popen3 (   cmd,
  mode = "t",
  bufsize = -1 
)

Definition at line 582 of file os.py.

References popen2.popen3().

583  def popen3(cmd, mode="t", bufsize=-1):
584  import popen2
585  stdout, stdin, stderr = popen2.popen3(cmd, bufsize)
return stdin, stdout, stderr
def os.popen4 (   cmd,
  mode = "t",
  bufsize = -1 
)

Definition at line 589 of file os.py.

References popen2.popen4().

590  def popen4(cmd, mode="t", bufsize=-1):
591  import popen2
592  stdout, stdin = popen2.popen4(cmd, bufsize)
return stdin, stdout
def os.removedirs (   name)
removedirs(path) -> None

Super-rmdir; remove a leaf directory and empty all intermediate
ones.  Works like rmdir except that, if the leaf directory is
successfully removed, directories corresponding to rightmost path
segments will be pruned way until either the whole path is
consumed or an error occurs.  Errors during this latter phase are
ignored -- they generally mean that a directory was not empty.

Definition at line 205 of file os.py.

206 def removedirs(name):
207  """removedirs(path) -> None
208 
209  Super-rmdir; remove a leaf directory and empty all intermediate
210  ones. Works like rmdir except that, if the leaf directory is
211  successfully removed, directories corresponding to rightmost path
212  segments will be pruned way until either the whole path is
213  consumed or an error occurs. Errors during this latter phase are
214  ignored -- they generally mean that a directory was not empty.
215 
216  """
217  rmdir(name)
218  head, tail = path.split(name)
219  if not tail:
220  head, tail = path.split(head)
221  while head and tail:
222  try:
223  rmdir(head)
224  except error:
225  break
226  head, tail = path.split(head)
def os.renames (   old,
  new 
)
renames(old, new) -> None

Super-rename; create directories as necessary and delete any left
empty.  Works like rename, except creation of any intermediate
directories needed to make the new pathname good is attempted
first.  After the rename, directories corresponding to rightmost
path segments of the old name will be pruned way until either the
whole path is consumed or a nonempty directory is found.

Note: this function can fail with the new directory structure made
if you lack permissions needed to unlink the leaf directory or
file.

Definition at line 227 of file os.py.

References makedirs(), and removedirs().

228 def renames(old, new):
229  """renames(old, new) -> None
230 
231  Super-rename; create directories as necessary and delete any left
232  empty. Works like rename, except creation of any intermediate
233  directories needed to make the new pathname good is attempted
234  first. After the rename, directories corresponding to rightmost
235  path segments of the old name will be pruned way until either the
236  whole path is consumed or a nonempty directory is found.
237 
238  Note: this function can fail with the new directory structure made
239  if you lack permissions needed to unlink the leaf directory or
240  file.
241 
242  """
243  head, tail = path.split(new)
244  if head and tail and not path.exists(head):
245  makedirs(head)
246  rename(old, new)
247  head, tail = path.split(old)
248  if head and tail:
249  try:
250  removedirs(head)
251  except error:
252  pass
253 
254 __all__.extend(["makedirs", "removedirs", "renames"])
255 
256 # Make sure os.environ exists, at least
257 try:
environ
def os.spawnl (   mode,
  file,
  args 
)
spawnl(mode, file, *args) -> integer

Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. 

Definition at line 523 of file os.py.

References spawnv().

524  def spawnl(mode, file, *args):
525  """spawnl(mode, file, *args) -> integer
526 
527 Execute file with arguments from args in a subprocess.
528 If mode == P_NOWAIT return the pid of the process.
529 If mode == P_WAIT return the process's exit code if it exits normally;
530 otherwise return -SIG, where SIG is the signal that killed it. """
531  return spawnv(mode, file, args)
def os.spawnle (   mode,
  file,
  args 
)
spawnle(mode, file, *args, env) -> integer

Execute file with arguments from args in a subprocess with the
supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. 

Definition at line 532 of file os.py.

References spawnve().

533  def spawnle(mode, file, *args):
534  """spawnle(mode, file, *args, env) -> integer
535 
536 Execute file with arguments from args in a subprocess with the
537 supplied environment.
538 If mode == P_NOWAIT return the pid of the process.
539 If mode == P_WAIT return the process's exit code if it exits normally;
540 otherwise return -SIG, where SIG is the signal that killed it. """
541  env = args[-1]
542  return spawnve(mode, file, args[:-1], env)
def os.spawnlp (   mode,
  file,
  args 
)
spawnlp(mode, file, *args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. 

Definition at line 546 of file os.py.

References spawnvp().

547  def spawnlp(mode, file, *args):
548  """spawnlp(mode, file, *args, env) -> integer
549 
550 Execute file (which is looked for along $PATH) with arguments from
551 args in a subprocess with the supplied environment.
552 If mode == P_NOWAIT return the pid of the process.
553 If mode == P_WAIT return the process's exit code if it exits normally;
554 otherwise return -SIG, where SIG is the signal that killed it. """
555  return spawnvp(mode, file, args)
def os.spawnlpe (   mode,
  file,
  args 
)
spawnlpe(mode, file, *args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. 

Definition at line 556 of file os.py.

References spawnvpe().

557  def spawnlpe(mode, file, *args):
558  """spawnlpe(mode, file, *args, env) -> integer
559 
560 Execute file (which is looked for along $PATH) with arguments from
561 args in a subprocess with the supplied environment.
562 If mode == P_NOWAIT return the pid of the process.
563 If mode == P_WAIT return the process's exit code if it exits normally;
564 otherwise return -SIG, where SIG is the signal that killed it. """
565  env = args[-1]
566  return spawnvpe(mode, file, args[:-1], env)
567 
def os.spawnv (   mode,
  file,
  args 
)
spawnv(mode, file, args) -> integer

Execute file with arguments from args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. 

Definition at line 478 of file os.py.

479  def spawnv(mode, file, args):
480  """spawnv(mode, file, args) -> integer
481 
482 Execute file with arguments from args in a subprocess.
483 If mode == P_NOWAIT return the pid of the process.
484 If mode == P_WAIT return the process's exit code if it exits normally;
485 otherwise return -SIG, where SIG is the signal that killed it. """
486  return _spawnvef(mode, file, args, None, execv)
def os.spawnve (   mode,
  file,
  args,
  env 
)
spawnve(mode, file, args, env) -> integer

Execute file with arguments from args in a subprocess with the
specified environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. 

Definition at line 487 of file os.py.

488  def spawnve(mode, file, args, env):
489  """spawnve(mode, file, args, env) -> integer
490 
491 Execute file with arguments from args in a subprocess with the
492 specified environment.
493 If mode == P_NOWAIT return the pid of the process.
494 If mode == P_WAIT return the process's exit code if it exits normally;
495 otherwise return -SIG, where SIG is the signal that killed it. """
496  return _spawnvef(mode, file, args, env, execve)
def os.spawnvp (   mode,
  file,
  args 
)
spawnvp(mode, file, args) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. 

Definition at line 499 of file os.py.

500  def spawnvp(mode, file, args):
501  """spawnvp(mode, file, args) -> integer
502 
503 Execute file (which is looked for along $PATH) with arguments from
504 args in a subprocess.
505 If mode == P_NOWAIT return the pid of the process.
506 If mode == P_WAIT return the process's exit code if it exits normally;
507 otherwise return -SIG, where SIG is the signal that killed it. """
508  return _spawnvef(mode, file, args, None, execvp)
def os.spawnvpe (   mode,
  file,
  args,
  env 
)
spawnvpe(mode, file, args, env) -> integer

Execute file (which is looked for along $PATH) with arguments from
args in a subprocess with the supplied environment.
If mode == P_NOWAIT return the pid of the process.
If mode == P_WAIT return the process's exit code if it exits normally;
otherwise return -SIG, where SIG is the signal that killed it. 

Definition at line 509 of file os.py.

510  def spawnvpe(mode, file, args, env):
511  """spawnvpe(mode, file, args, env) -> integer
512 
513 Execute file (which is looked for along $PATH) with arguments from
514 args in a subprocess with the supplied environment.
515 If mode == P_NOWAIT return the pid of the process.
516 If mode == P_WAIT return the process's exit code if it exits normally;
517 otherwise return -SIG, where SIG is the signal that killed it. """
518  return _spawnvef(mode, file, args, env, execvpe)
def os.unsetenv (   key)

Definition at line 369 of file os.py.

370  def unsetenv(key):
371  putenv(key, "")

Variable Documentation

list __all__
Initial value:
1 = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep",
2  "defpath", "name"]

Definition at line 31 of file os.py.

_names = sys.builtin_module_names

Definition at line 27 of file os.py.

_notfound = None

Definition at line 311 of file os.py.

altsep = None

Definition at line 29 of file os.py.

string curdir = '.'

Definition at line 43 of file os.py.

string defpath = ':/bin:/usr/bin'

Definition at line 44 of file os.py.

dictionary environ = {}

Definition at line 259 of file os.py.

string extsep = '/'

Definition at line 174 of file os.py.

string linesep = '\n'

Definition at line 42 of file os.py.

string name = 'posix'

Definition at line 41 of file os.py.

int P_NOWAIT = 1

Definition at line 445 of file os.py.

int P_WAIT = 0

Definition at line 444 of file os.py.

path = posixpath

Definition at line 51 of file os.py.