def touch_init(parent_dir, child_dir):
 if (not child_dir.startswith(parent_dir)):
  logging.error(('%s is not a subdirectory of %s' % (child_dir, parent_dir)))
  return
 sub_parent_dirs = parent_dir.split(os.path.sep)
 sub_child_dirs = child_dir.split(os.path.sep)
 for sub_dir in sub_child_dirs[len(sub_parent_dirs):]:
  sub_parent_dirs.append(sub_dir)
  path = os.path.sep.join(sub_parent_dirs)
  init_py = os.path.join(path, '__init__.py')
  open(init_py, 'a').close()

def touch_init ( parent_dir , child_dir ) : if ( not child_dir . startswith ( parent_dir ) ) : logging . error ( ( '%s is not a subdirectory of %s' % ( child_dir , parent_dir ) ) ) return sub_parent_dirs = parent_dir . split ( os . path . sep ) sub_child_dirs = child_dir . split ( os . path . sep ) for sub_dir in sub_child_dirs [ len ( sub_parent_dirs ) : ] : sub_parent_dirs . append ( sub_dir ) path = os . path . sep . join ( sub_parent_dirs ) init_py = os . path . join ( path , '__init__.py' ) open ( init_py , 'a' ) . close ( )
touch __init__ .