old_contents: #!/usr/bin/env python3
  """Script to automate logging into Perforce.
  
  Use P4API to log in to the server.
  
  """
  
  import P4
  
  
  def main():
      """Log in to the Perforce server."""
      # Yep, pretty much that easy.
      p4 = P4.P4()
      p4.connect()
      p4.run_login()
  
  
  if __name__ == "__main__":
      main()
  
new_contents: #!/usr/bin/env python
  """Script to automate logging into Perforce."""
  
  import subprocess
  import sys
  
  
  def main():
      """Log in to the Perforce server."""
      # Yep, pretty much that easy.
      result = subprocess.check_output(['p4', 'set', '-q', 'P4PASSWD'])
      passwd = result.strip().split('=')[1]
      proc = subprocess.Popen(['p4', 'login'], stdin=subprocess.PIPE)
      proc.communicate(passwd)
      sys.exit(proc.returncode)
  
  
  if __name__ == "__main__":
      main()
  
subject: Use p4 cli instead of p4 api