我现在已经苦苦挣扎了很长时间,仍然无法使这行代码正常工作:
os.system('su - postgres -c "psql -c \'ALTER USER postgres WITH ENCRYPTED PASSWORD \\\"{0}\\\";\'"'.format(self.password))
并记录结果:
2013-11-12 19:58:42 ICT ERROR: syntax error at or near ""password"" at character 45
2013-11-12 19:58:42 ICT STATEMENT: ALTER USER postgres WITH ENCRYPTED PASSWORD "password";
任何想法 ?