Skip to content

Commit

Permalink
Python 3 fixes for watcher_node.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepurvis committed Jul 30, 2019
1 parent fd6e5bd commit ffc3f52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wireless_watcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ find_package(catkin REQUIRED)

catkin_package()

install(PROGRAMS
catkin_install_python(PROGRAMS
nodes/watcher_node
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
Expand Down
6 changes: 3 additions & 3 deletions wireless_watcher/nodes/watcher_node
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# Software License Agreement (BSD)
#
# @author Mike Purvis <mpurvis@clearpath.ai>
Expand Down Expand Up @@ -94,13 +94,13 @@ def main():
while not rospy.is_shutdown():
try:
ip_str = subprocess.check_output(['ip', 'addr', 'show', dev], stderr=subprocess.STDOUT)
if re.search(r'^\s*inet\s', ip_str, re.MULTILINE):
if re.search(b'^\s*inet\s', ip_str, re.MULTILINE):
connected_pub.publish(True)
except subprocess.CalledProcessError:
connected_pub.publish(False)

try:
wifi_str = subprocess.check_output(['iwconfig', dev], stderr=subprocess.STDOUT)
wifi_str = subprocess.check_output(['iwconfig', dev], stderr=subprocess.STDOUT).decode()
fields_str = re.split('\s\s+', wifi_str)
fields_list = [re.split('[:=]', field_str, maxsplit=1) for field_str in fields_str]
fields_dict = {'dev': fields_str[0], 'type': fields_str[1]}
Expand Down

0 comments on commit ffc3f52

Please sign in to comment.