# Path: torext/utils.py
# def import_module(name, package=None):
#     """Import a module.
# 
#     The 'package' argument is required when performing a relative import. It
#     specifies the package to use as the anchor point from which to resolve the
#     relative import to an absolute import.
# 
#     Usage:
#     >>> epoll_module = import_module('tornado.platform.epoll')
#     """
#     if name.startswith('.'):
#         if not package:
#             raise TypeError("relative imports require the 'package' argument")
#         level = 0
#         for character in name:
#             if character != '.':
#                 break
#             level += 1
#         name = _resolve_name(name[level:], package, level)
#     __import__(name)
#     return sys.modules[name]


import os
import re
import sys
import shutil
import optparse
import torext
from torext.utils import import_module
        self.msg = msg
        print(self.__str__() + '\n')
        parser.print_help()
        sys.exit()

    def __str__(self):
        return self.__class__.__name__ + ': %s' % self.msg


def main():
    options, args = parser.parse_args()

    try:
        name = args[0]
    except IndexError:
        raise CommandInputError('one arg is required')
    # If it's not a valid directory/file name.
    if not re.search(r'^[_a-zA-Z]\w*$', name):
        # Provide a smart error message, depending on the error.
        if not re.search(r'^[_a-zA-Z]', name):
            message = 'make sure the name begins with a letter or underscore'
        else:
            message = 'use only numbers, letters and underscores'
        raise CommandInputError(message)

    cwd = os.getcwd()
    torext_path = os.path.dirname(torext.__file__)

    # Check that the project name cannot be imported.
    try:

# Path: torext/utils.py
# def import_module(name, package=None):
#     """Import a module.
# 
#     The 'package' argument is required when performing a relative import. It
#     specifies the package to use as the anchor point from which to resolve the
#     relative import to an absolute import.
# 
#     Usage:
#     >>> epoll_module = import_module('tornado.platform.epoll')
#     """
#     if name.startswith('.'):
#         if not package:
#             raise TypeError("relative imports require the 'package' argument")
#         level = 0
#         for character in name:
#             if character != '.':
#                 break
#             level += 1
#         name = _resolve_name(name[level:], package, level)
#     __import__(name)
#     return sys.modules[name]


# Path: torext/scripts/sketch.py
import os
import re
import sys
import shutil
import optparse
import torext
from torext.utils import import_module

        self.msg = msg
        print(self.__str__() + '\n')
        parser.print_help()
        sys.exit()

    def __str__(self):
        return self.__class__.__name__ + ': %s' % self.msg


def main():
    options, args = parser.parse_args()

    try:
        name = args[0]
    except IndexError:
        raise CommandInputError('one arg is required')
    # If it's not a valid directory/file name.
    if not re.search(r'^[_a-zA-Z]\w*$', name):
        # Provide a smart error message, depending on the error.
        if not re.search(r'^[_a-zA-Z]', name):
            message = 'make sure the name begins with a letter or underscore'
        else:
            message = 'use only numbers, letters and underscores'
        raise CommandInputError(message)

    cwd = os.getcwd()
    torext_path = os.path.dirname(torext.__file__)

    # Check that the project name cannot be imported.
    try:

        import_module(name)