Click here to Skip to main content
15,746,652 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
import subprocess
import re
import optparse
ifconfig_result = subprocess.check_output(["ifconfig", options.interface])
mac_address_search_result ="\w\w:\w\w:\w\w:\w\w:\w\w:\w\w", ifconfig_result)

What I have tried:

tried converting double quoted string to single quoted
Updated 6-May-20 10:45am
ZurdoDev 6-May-20 10:18am    
Which line of code gives that error?
ZurdoDev 6-May-20 10:19am    
The error likely is saying you can't use search on a byte. You can also use search on strings.

1 solution

mac_address_search_result ="\w\w:\w\w:\w\w:\w\w:\w\w:\w\w", ifconfig_result.decode('utf-8'))
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900