def generate_password(self): cmd="apg -n 1 -m 10 -M NCL -d" output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) new_password="_"+output.decode("utf-8")+"_" return new_password