Sha*_*n-x 0 python mysql ssh paramiko python-2.7
由于某些原因,我不得不使用mysqlParamiko。
我有这个(简化的)片段:
stdin, stdout, stderr = c.exec_command("mysql stuff -e 'rename table foo to bar'")
print stdout.read()
print stderr.read()
Run Code Online (Sandbox Code Playgroud)
但如果表foo不存在,我就没有输出(没有stdout或stdin输出)。
但这很奇怪,因为:
stdin, stdout, stderr = c.exec_command("mysql stuff -e 'rename table foo to bar'")
if stderr.read()
print "Error: %s" % stderr.read()
print type(stderr.read())
Run Code Online (Sandbox Code Playgroud)
有这个输出:
Error:
<type 'str'>
Run Code Online (Sandbox Code Playgroud)
而mysql错误通常是:
第 1 行出现错误 1017 (HY000):找不到文件:“./stuff/foo.frm”(错误号:2 - 没有这样的文件或目录)
我想要更详细的错误输出,但我不能。为什么?