title: WLST: cannot call edit functions when you are not in the edit tree
body: <p>I'm trying to run the following WLST script</p>
  
  <pre><code>import java.lang
  import os
  import string
  
  # 1 - Connecting to the Destination
  connect(username,password,server_url)
  
  edit()
  
  # 2 - Security Realm
  print ""
  print "================== Seucrity Realm ==================="
  startEdit()
  serverConfig()
  
  ap = cmo.getSecurityConfiguration().getDefaultRealm().lookupAuthenticationProvid
  er('DefaultAuthenticator')
  
  print "Create group " + user_group
  ap.createGroup(user_group, user_group)
  
  print "Craete user " + user_name
  ap.createUser(user_name, user_pass, user_name)
  
  print "Add user " + user_name + " to group " + user_group
  ap.addMemberToGroup(user_group, user_name)
  
  print "Create global role " + user_role
  
  rm = cmo.getSecurityConfiguration().getDefaultRealm().lookupRoleMapper('XACMLRol
  eMapper')
  rm.createRole(None, user_role, None)
  rm.setRoleExpression(None, user_role, 'Grp(' + user_group + ')')
  
  # Save, activate and exit
  # ==========================
  print ""
  save()
  activate()
  exit()
  </code></pre>
  
  <p>But get the error</p>
  
  <pre><code>No stack trace available.
  Problem invoking WLST - Traceback (innermost last):
    File "/u01/oracle/security-realm-config.py", line 40, in ?
    File "&lt;iostream&gt;", line 510, in save
    File "&lt;iostream&gt;", line 553, in raiseWLSTException
  WLSTException: Error occurred while performing save : Cannot call Edit functions
   when you are not in the Edit tree.
  </code></pre>
  
  <p>The script still works, but why it prints this error, and how to avoid it?</p>