【发布时间】:2013-07-08 01:44:21
【问题描述】:
我写了下面的代码在sqlplus中运行一个脚本
(username, password, host) = ("user","psw","isntance")
conn_string = " %s/%s@%s "% (username,password,host)
session = Popen(['sqlplus','-S', conn_string], stdin=PIPE, stdout=PIPE, stderr=PIPE)
sql_file = '%s/%s' % ('/my/folder', 'File.sql')
f= open(sql_file,'r')
cmd = f.read()
session.stdin.write(cmd)
stdout, stderr = session.communicate()
代码执行没有任何错误。但我没有看到任何打印结果。不确定我哪里出错了。
【问题讨论】:
标签: python python-2.7 sqlplus