#!/usr/bin/env python
import subprocess
import optparse
import re
def get_arguments():
parser = optparse.OptionParser()
parser.add_option("-i", "--interface", dest="interface",
help="Specify the interface of which you want to change the MAC address.")
parser.add_option("-m", "--mac", dest="new_mac",
help="Specify a random MAC address you would like to the interface to use.")
(options, arguments) = parser.parse_args()
if not options.interface():
parser.error("[-] Error: interface not specified, use --help for more info.")
elif not options.new_mac:
parser.error("[-] Error: MAC address not specified, use --help for more info.")
return options
options = get_arguments()
ifconfig_result = subprocess.check_output(["ifconfig", options.interface])
print(ifconfig_result)
/home/admon/PycharmProjects/myNew/venv/bin/python /home/admon/PycharmProjects/myNew/main.py
Traceback (most recent call last):
File "/home/admon/PycharmProjects/myNew/main.py", line 20, in <module>
options = get_arguments()
File "/home/admon/PycharmProjects/myNew/main.py", line 14, in get_arguments
if not options.interface():
TypeError: 'NoneType' object is not callable
Process finished with exit code 1
...
start_b = Button(root, label="Старт", command=start_pr).pack()
start_b.place(relx=1, rely=1) #Тут ошибка "TypeError: 'NoneType' object..."
...
...
(options, arguments) = parser.parse_args()
...
... parser.parse_args()
что-то не равное NoneType.