Jun 5, 2019 08:10 AM
(This post was last modified: Jun 5, 2019 08:29 AM by Magpi3.)
Hi there, small problem when I was working on my python script shown below:
The code throws up this error:
File "/root/Documents/PyCharmProjects/JB's Python Practice/MAC-Address-Changer.py", line 10, in <module>
subprocess.call("ifconfig {0} down").format(NETWORK)
File "/usr/lib/python3.7/subprocess.py", line 323, in call
with Popen(*popenargs, kwargs) as p:
File "/usr/lib/python3.7/subprocess.py", line 775, in_init_
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, inexecute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ifconfig {0} down': 'ifconfig {0} down'
Anyone got any hints about this? help is appreciated, thanks
Sorry, forgot about shell=True, but upon adding that I now recieve this error
SIOCSIFHWADDR: Cannot assign requested address
File "/usr/lib/python3.7/subprocess.py", line 775, in __init_
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ifconfig {0} down': 'ifconfig {0} down'
Anyone got any hints about this? help is appreciated, thanks
Sorry, forgot about shell=True, but upon adding that I now recieve this error
SIOCSIFHWADDR: Cannot assign requested address
Nevermind, problem solved, me being stupid
Code
#!/usr/bin/env python
import subprocess
print("\n **MAC Address Changer 1.2** \n \n \n \n")
subprocess.call("ifconfig")
NETWORK = input("\n Please enter the Network Interface you wish to change (e.g wlan0, eth0) - ")
ADDRESS = input("\n Please enter the New MAC Address (E.G 11:22:33:44:55:66) - ")
subprocess.call("ifconfig {0} down").format(NETWORK)
subprocess.call("ifconfig {0} hw ether {1}".format(NETWORK, ADDRESS), shell=True)The code throws up this error:
File "/root/Documents/PyCharmProjects/JB's Python Practice/MAC-Address-Changer.py", line 10, in <module>
subprocess.call("ifconfig {0} down").format(NETWORK)
File "/usr/lib/python3.7/subprocess.py", line 323, in call
with Popen(*popenargs, kwargs) as p:
File "/usr/lib/python3.7/subprocess.py", line 775, in_init_
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, inexecute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ifconfig {0} down': 'ifconfig {0} down'
Anyone got any hints about this? help is appreciated, thanks
Sorry, forgot about shell=True, but upon adding that I now recieve this error
SIOCSIFHWADDR: Cannot assign requested address
(Jun 5, 2019 08:10 AM)Magpi3 Wrote: Hi there, small problem when I was working on my python script shown below:kwargs) as p:
Code#!/usr/bin/env python
import subprocess
print("\n **MAC Address Changer 1.2** \n \n \n \n")
subprocess.call("ifconfig")
NETWORK = input("\n Please enter the Network Interface you wish to change (e.g wlan0, eth0) - ")
ADDRESS = input("\n Please enter the New MAC Address (E.G 11:22:33:44:55:66) - ")
subprocess.call("ifconfig {0} down").format(NETWORK)
subprocess.call("ifconfig {0} hw ether {1}".format(NETWORK, ADDRESS), shell=True)
The code throws up this error:
File "/root/Documents/PyCharmProjects/JB's Python Practice/MAC-Address-Changer.py", line 10, in <module>
subprocess.call("ifconfig {0} down").format(NETWORK)
File "/usr/lib/python3.7/subprocess.py", line 323, in call
with Popen(*popenargs,
File "/usr/lib/python3.7/subprocess.py", line 775, in __init_
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ifconfig {0} down': 'ifconfig {0} down'
Anyone got any hints about this? help is appreciated, thanks
Sorry, forgot about shell=True, but upon adding that I now recieve this error
SIOCSIFHWADDR: Cannot assign requested address
Nevermind, problem solved, me being stupid

