Skip to content

Conversation

@jtpereyda
Copy link
Contributor

Problem

When running network_monitor.py on Ubuntu, it would crash while trying to create the usage text.

Solution

create_usage was using global variables IFS and device when they weren't yet declared, and using device where it should have been pcapy_device. The first commit was the minimal fix.

The second commit sought to eliminate these global variables and clean up a couple warnings. Change summary:

  • new get_ifs() method makes IFS variable available to main
  • create_usage() now takes IFS as an input
  • IFS renamed to ifs (PEP8)
  • added main() method so that main code executes in a local scope. This addressed shadowing issues with the ifs variable.
  • added required packages as suggested by PyCharm
  • added docstrings

create_usage() is now side-effect free and we're using less global variables!

Tested

on Ubuntu. Verified docstring works and that network_monitor.py starts and accepts connections. I haven't figure out how to get Tornado on Windows yet so I can't test it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant