Bug 885 - Error in Ascii tracing in Python examples
Error in Ascii tracing in Python examples
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: examples
pre-release
All All
: P5 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-19 14:30 EDT by Kim Højgaard-Hansen
Modified: 2010-04-20 14:14 EDT (History)
1 user (show)

See Also:


Attachments
fix ascii tracing in python example scripts (1.26 KB, patch)
2010-04-19 14:30 EDT, Kim Højgaard-Hansen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Højgaard-Hansen 2010-04-19 14:30:10 EDT
Created attachment 836 [details]
fix ascii tracing in python example scripts

The ascii tracing Python API seems to have changed after the example python scripts was made, and is currently broken. I guess the reason it has gone undetected so far is that it is commented out in the examples, hence not run when they are executed in their default versions.

Commenting in the ascii tracing in csma-bridge.py and running it:

kimrhh@exherbo-work-laptop ~/Downloads/ns-allinone-3.7.1/ns-3.7.1 $ ./waf --pyrun examples/csma/csma-bridge.py 
Waf: Entering directory `/home/kimrhh/Downloads/ns-allinone-3.7.1/ns-3.7.1/build'
Waf: Leaving directory `/home/kimrhh/Downloads/ns-allinone-3.7.1/ns-3.7.1/build'
'build' finished successfully (1.340s)
  File "examples/csma/csma-bridge.py", line 126
    std.ofstream ascii
                     ^
SyntaxError: invalid syntax
Command ['/usr/bin/python', 'examples/csma/csma-bridge.py'] exited with code 1

a patch to fix the two examples with the broken syntax is attached.

another thing is, would it be an idea to add ascii tracing to all the examples, and have it running per default? then regressions would be caught easier and a user try one randomly chosen (usually that's how you start) python script would not have to search a lot to get ascii tracing going. Just a thought, maybe that should go i another bug ? :)
Comment 1 Kim Højgaard-Hansen 2010-04-19 14:31:07 EDT
oh i forgot to state: this bug is present in ns3-dev still. The patch is made with "hg diff" on a ns3-dev checkout
Comment 2 Josh Pelkey 2010-04-20 14:14:51 EDT
I went ahead and submitted changes for these, but left them commented.  If you would like to see tracing by default in all python examples, please file a p5 enh bug.  Thanks!

changeset: a02c44146209