Home | Trees | Index | Help |
|
---|
Module Sys |
|
New: expandpath
.
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) # what would basename(splitext(filename)[0]) print?
Attention: The module is called sys, not Sys.
Function Summary | |
---|---|
string |
Get the base name (filename stripped from dir info) of 'path'. |
string |
Get the dir name (dir path stripped from filename) of 'path'. |
int |
Tell if the given pathname (file or dir) exists. |
string |
Expand the given Blender 'path' into an absolute and valid path. |
string |
Join the given dir and file paths, using the proper separator for each platform. |
string |
Remove extension from 'path', append extension 'ext' (if given) to the result and return it. |
Sleep for the specified amount of time. | |
list with two strings |
Split 'path' into (root, ext), where 'ext' is a file extension. |
float |
Get the current time in seconds since a fixed value. |
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'.
|
dirname(path)Get the dir name (dir path stripped from filename) of 'path'.
|
exists(path)Tell if the given pathname (file or dir) exists.
|
expandpath(path)Expand the given Blender 'path' into an absolute and valid path. Internally, Blender recognizes two special character sequences in paths:
|
join(dir, file)Join the given dir and file paths, using the proper separator for each platform.
|
makename(path="Blender.Get('filename')", ext='', strip=0)Remove extension from 'path', append extension 'ext' (if given) to the result and return it. If 'strip' is non-zero, also remove dirname from path. Example:import Blender from Blender.sys import * print makename('/path/to/myfile.txt','.abc', 1) # returns 'myfile.abc' print makename('/path/to/myfile.obj', '-01.obj') # '/path/to/myfile-01.obj' print makename('/path/to/myfile.txt', strip = 1) # 'myfile' # note that: print makename(ext = '.txt') # is equivalent to: print sys.splitext(Blender.Get('filename'))[0]) + '.txt'
|
sleep(millisecs=10)Sleep for the specified amount of time.
|
splitext(path)Split 'path' into (root, ext), where 'ext' is a file extension.
|
time()Get the current time in seconds since a fixed value. Successive calls to this function are guaranteed to return values greater than the previous call.
|
Variable Details |
---|
dirsepsame assep .
|
prognamethe Blender executable (argv[0]).
|
septhe platform-specific dir separator for this Blender: '/' everywhere, except on Win systems, that use '\'.
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Jun 13 15:31:22 2005 | http://epydoc.sf.net |