亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標題:
python 調(diào)用freetds的連接測試問題
[打印本頁]
作者:
noobkey
時間:
2013-11-25 09:19
標題:
python 調(diào)用freetds的連接測試問題
我用freetds 連接的sqlserver 數(shù)據(jù)庫
但是最近經(jīng)常連接出現(xiàn)問題 ,于是我就想用python腳本來判斷freetds的連接
我用commands 的模塊 執(zhí)行shell 命令來測試 freetds的連接
commands.getstatusoutput(“/usr/bin/tsql -S sqlserver -U sa -P 123456”)
但是程序無法返回, 是因為tsql測試連接時,程序一直處于連接狀態(tài)沒有釋放這個shell命令,所有 command模塊收不到返回值,想請問各位有沒有其他辦法來處理這個問題
謝謝
作者:
wenhq
時間:
2013-11-25 09:42
http://hi.baidu.com/leechl/item/bfb07803550b81863d42e27c
http://docs.python.org/2/library/commands.html
commands.getstatus
作者:
noobkey
時間:
2013-11-25 13:05
這個不行啊 , commands.getstatus 只接受 file參數(shù)
我得到這個shell 的結(jié)果
作者:
wenhq
時間:
2013-11-25 16:24
>>> import commands
>>> commands.getstatusoutput('ls /bin/ls')
(0, '/bin/ls')
>>> commands.getstatusoutput('cat /bin/junk')
(256, 'cat: /bin/junk: No such file or directory')
>>> commands.getstatusoutput('/bin/junk')
(256, 'sh: /bin/junk: not found')
>>> commands.getoutput('ls /bin/ls')
'/bin/ls'
>>> commands.getstatus('/bin/ls')
'-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls'
可以得到結(jié)果啊。。。
歡迎光臨 Chinaunix (http://www.72891.cn/)
Powered by Discuz! X3.2