Example #1
0
def boot():
    from sys import path as module_path
    from os.path import abspath as path_absolute, join as path_join

    module_path.insert(1, path_absolute(path_join(module_path[0], '..')))
    module_path.insert(
        2, path_absolute(path_join(module_path[0], '../../Gem-py')))

    import Gem
Example #2
0
def boot():
    from sys import path as module_path
    from os.path import abspath as path_absolute, join as path_join

    path_0 = module_path[0]

    module_path.insert(0, path_absolute(path_join(path_0, '../')))
    module_path.insert(1, path_absolute(path_join(path_0, '../../Gem')))

    import Gem
# Platform-independent file path handling.
# (Additional functions are added to module depending on platform,
#   but the core is platform-independent.)
# There is really no reason why your code should be limited to one platform,
# such as Linux, MacOS X, or Windows. No extra work is required in most cases.
from os.path import (
    abspath     as path_absolute,
    relpath     as path_relative,
    curdir      as path_curdir,
    pardir      as path_pardir,
    extsep      as path_extsep,
    join        as path_join,
)

# Transform to the absolute path to the current directory.
print( path_absolute( path_curdir ) )
# Transform to the relative path to the parent directory.
print( path_relative( path_pardir ) )

# Join various elements together into a path.
# Is like p1 + os.path.dirsep + p2 etc....
print( path_join( path_curdir, "stdlib-demo" + path_extsep + "py" ) )

# <demo> --- stop ---

### 'os.path' Module ###
from os.path import(
    expanduser  as path_expand_user,
    dirname     as path_dirname,
    basename    as path_basename,
)