Enable every module that isn't marked as disabled in the modules folder.
  This function is meant to be called when seash is initializing and nowhere
  else.  A module is marked as disabled when there is a modulename.disabled 
  file.

def enable_modules_from_last_session(seashcommanddict):
  """
  Enable every module that isn't marked as disabled in the modules folder.
  This function is meant to be called when seash is initializing and nowhere
  else.  A module is marked as disabled when there is a modulename.disabled 
  file.
  """
  successfully_enabled_modules = []
  modules_to_enable = get_enabled_modules()
  for modulename in modules_to_enable:
    # There are no bad side effects to seash's state when we do this
    # The only thing that should happen is that the modulename.disabled file
    # gets created (temporarily)
    disable(seashcommanddict, modulename)
    try:
      enable(seashcommanddict, modulename)
      successfully_enabled_modules.append(modulename)
    except seash_exceptions.ModuleConflictError, e:
      print "Failed to enable the '"+modulename+"' module due to the following conflicting command:"
      print str(e)

      # We mark this module as disabled by adding a modulename.disabled file.
      open(MODULES_FOLDER_PATH + os.sep + modulename + ".disabled", 'w')
    except seash_exceptions.InitializeError, e:
      print "Failed to enable the '"+modulename+"' module."
      disable(seashcommanddict, modulename)
  successfully_enabled_modules.sort()
  
  print 'Enabled modules:', ', '.join(successfully_enabled_modules), '\n'