每个学生。在
我已经从psycopg2-2.5.1.win32-py2.6-pg9.2.4包中安装了psycopg2-版本.exe在站点http://www.stickpeople.com/projects/python/win-psycopg/中找到。 我可以导入它并连接到数据库,但是当我在命令行上运行我的脚本(标准和Cygwin)时,会将不需要的消息打印到stderr。在
例如:
conn = psycopg2.connect(host="42.42.42.42", port=5432, database="myDB", user="myUser", password="********")
if conn is None:
sys.exit("Connection failed")
print "Connection successful"
打印如下:
^{pr2}$我无法关闭这些信息。我在Google上搜索,但没有找到任何相关的东西,我还尝试更改标准日志模块的配置,以防其中一些模块被使用,但仍然没有效果。在
有人知道如何阻止这些信息吗?在
提前谢谢!在
这些信息来自Postgres本身。第二个是DEBUG3 模块
backend/access/transam/xact.c
中的消息。我会看看 在您的postgresql.conf
中记录设置。在看起来这个构建是用
PSYCOPG_DEBUG
标志集生成的,在查看http://www.stickpeople.com/projects/python/win-psycopg/处的表之后,发布版本不应该是这样(注意最后一列Debug Build ( define PSYCOPG_DEBUG)
)。但是看起来您已经设置了PSYCOPG_DEBUG
环境变量。如果是这种情况,那么取消设置它应该可以防止发出这些调试消息。在从psycopg2.txt
相关问题 更多 >
编程相关推荐