New answers tagged python-3.x
Since you wrote in your comment you want to make the output of the unchanged program stable when it is not changed between two runs, you already excluded "accidental changes to module variables" - without any changes, there can be no "accidental changes". The SO link you posted in your question mentioned how to initialize Python's hash seed to a fixed ...
I would add a bunch of unit tests for the individual modules and use something like Jenkins to compile and run the tests every time you make code changes. If you are finding variations when running, this should help you narrow it down so that you can change module logic to ensure repeatability.
The functionality for that is located in the pcap API. The implementation of that is in library libpcap for Unix/Linux and library Winpcap for Windows. There are Python wrappers, e.g. pypcap, to access those libraries. Depending on your system, you might need 'elevated privileges' (root/administrator) to gain access to packet data. Wireshark is built on ...
I don't see the problem with your approach. I think you are almost there. If you change your generator to yield None when there is nothing to return, then you can simply test for that. See the following example: #!/usr/bin/python import sys import time tailpath = "./tailfile" fd = open(tailpath) def tail_follow(file): while True: line = ...
Top 50 recent answers are included