【发布时间】:2020-01-08 03:20:04
【问题描述】:
Traceback(最近一次调用最后一次): 文件“hello.py”,第 12 行,在 接口=选项.接口 AttributeError:“值”对象没有属性“接口”
import subprocess
import optparse
parser = optparse.OptionParser()
parser.add_option("-i", "--interface", dest=" interface ", help=" Interface to change its MAC address ")
parser.add_option("-m", "--mac", dest=" mac ", help=" new mac address ")
(options, arguments) = parser.parse_args()
interface = options.interface
mac = options.mac
print("[+] Changing mac address for " + interface + " to " + mac)
subprocess.call(["ifconfig ", interface, " down"])
subprocess.call(["ifconfig ", interface, " hw", "ether", mac])
subprocess.call(["ifconfig ", interface, " up"])
注意:- 我正在使用 virtualBox 来运行这个程序。
【问题讨论】:
-
请在您的问题中包含完整错误消息。
标签: python object attributes