#NEWLINE# def _is_valid_name( self , project_name ) : #NEWLINE# #INDENT# def _module_exists( module_name ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# import_module ( module_name ) #NEWLINE# return True #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# if ( not re . search ( '^[_a-zA-Z]\\w*$' , project_name ) ) : #NEWLINE# #INDENT# print ( 'Error: Project names must begin with a letter and contain only\nletters, numbers and underscores' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if exists ( project_name ) : #NEWLINE# #INDENT# print ( ( 'Error: Directory %r already exists' % project_name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if _module_exists ( project_name ) : #NEWLINE# #INDENT# print ( ( 'Error: Module %r already exists' % project_name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return False