Module Sys
[frames | no frames]

Module Sys

The Blender.sys submodule.

sys

This module provides a minimal set of helper functions and data. Its purpose is to avoid the need for the standard Python module 'os', in special 'os.path', though it is only meant for the simplest cases.

Example:
 import Blender

 filename = ""
 def f(name): # file selector callback
   global filename
   filename = name

 Blender.Window.FileSelector(f)

 if filename:
   print 'basename:', Blender.sys.basename(filename)
   print 'dirname:',  Blender.sys.dirname(filename)
   print 'splitext:', Blender.sys.splitext(filename)

Attention: The module is called sys, not Sys.

Function Summary
string basename(path)
Get the base name (filename stripped from dir info) of 'path'.
string dirname(path)
Get the dir name (dir path stripped from filename) of 'path'.
list with two strings splitext(path)
Split 'path' into (root, ext), where 'ext' is a file extension.

Variable Summary
char dirsep: same as sep.
string progname: the Blender executable (argv[0]).
char sep: the platform-specific dir separator for this Blender: '/' everywhere, except on Win systems, that use '\'.

Function Details

basename(path)

Get the base name (filename stripped from dir info) of 'path'.
Parameters:
path - a path name
           (type=string)
Returns:
the base name
           (type=string)

dirname(path)

Get the dir name (dir path stripped from filename) of 'path'.
Parameters:
path - a path name
           (type=string)
Returns:
the dir name
           (type=string)

splitext(path)

Split 'path' into (root, ext), where 'ext' is a file extension.
Parameters:
path - a path name
           (type=string)
Returns:
(root, ext)
           (type=list with two strings)

Variable Details

dirsep

same as sep.
Type:
char

progname

the Blender executable (argv[0]).
Type:
string

sep

the platform-specific dir separator for this Blender: '/' everywhere, except on Win systems, that use '\'.
Type:
char

Generated by Epydoc 2.0 on Mon Feb 2 18:51:07 2004 http://epydoc.sf.net