print -> info; end the horror of print vs. print()
Although we could use print() from __future__, this messes up scripts which use examples as modules. The simple, if not nicest for 2.7, solution is to use info(), output() and other mininet.log functions. The disadvantage is that we may have to adjust things if we change info() to add automatic newlines, but we can burn that bridge in Mininet 3.x.
This commit is contained in:
+3
-3
@@ -6,7 +6,7 @@ Example to create a Mininet topology and connect it to the internet via NAT
|
||||
|
||||
|
||||
from mininet.cli import CLI
|
||||
from mininet.log import lg
|
||||
from mininet.log import lg, info
|
||||
from mininet.topolib import TreeNet
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ if __name__ == '__main__':
|
||||
# Add NAT connectivity
|
||||
net.addNAT().configDefault()
|
||||
net.start()
|
||||
print( "*** Hosts are running and should have internet connectivity" )
|
||||
print( "*** Type 'exit' or control-D to shut down network" )
|
||||
info( "*** Hosts are running and should have internet connectivity\n" )
|
||||
info( "*** Type 'exit' or control-D to shut down network\n" )
|
||||
CLI( net )
|
||||
# Shut down NAT
|
||||
net.stop()
|
||||
|
||||
Reference in New Issue
Block a user