0
我正在通過Python API來管理Canonical CM Landscape。我不知道是否有人可以幫助我,但我陷入了一個困境,我不知道它是否是該特定庫的簡單Python錯誤。這是較大的腳本的一部分,但當我嘗試使用此列表中的最後一個函數時,它會丟失。Python和landscape_api
import os, json, sys, subprocess, csv, datetime, time
from landscape_api.base import API, HTTPError
from subprocess import Popen,PIPE,STDOUT,call
uri = "xxxxxxxxxxxxxxxxxxxxxxxx"
key = "xxxxxxxxxxxxxxxxxxxx"
secret = "xxxxxxxxxxxxxxxxxxxxxxx"
api = API(uri, key, secret)
proc=Popen('zenity --entry --text "Fill with machine Tag to be searched" --entry- text "Type Tag"', shell=True, stdout=PIPE,) #Input from zenity window
output=proc.communicate()[0]
user="root"
script="2408"
mac = api.execute_script(query="tag:%s", script_id="script_id:%s", username="user:%s" %(output, script, user))
最新功能api.execute_script返回錯誤
Traceback (most recent call last):
File "Python_MAC_IP.py", line 35, in <module>
mac = api.execute_script(query="tag:%s", script_id="script_id:%s", username="user:%s" %(output, script, user))
TypeError: not all arguments converted during string formatting
的'%'操作符對一個字符串和替換的元組,而不是在同一行的代碼,每個字符串。 – geoffspear 2013-02-15 14:36:08