Home | Trees | Indices | Help |
|
---|
|
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.
Functions | |||
string |
|
||
string |
|
||
string |
|
||
tuple of two strings |
|
||
string |
|
||
int |
|
||
float |
|
||
|
|||
string |
|
||
string |
|
Variables | |
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 |
|
|
Warning: this simple function isn't intended to be a complete replacement for the standard os.path.join() one, which handles more general cases. |
Split 'path' into (root, ext), where 'ext' is a file extension including the full stop. Example:import Blender file, ext= Blender.sys.splitext('/tmp/foobar.blend') print file, ext # ('/tmp/foobar', '.blend')
Note: This function will raise an error if the path is longer then 80 characters. |
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'
|
|
|
|
Notes:
|
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Mon May 19 15:32:20 2008 | http://epydoc.sourceforge.net |