Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 fixes for watcher_node. #10

Merged
merged 1 commit into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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