bindings: (fixes #796) Gracefully exit when bindings are unavailable

This commit is contained in:
Gabriel Ferreira
2023-11-03 01:28:26 +00:00
parent 9b7088d363
commit 842871c6dc
20 changed files with 209 additions and 70 deletions

View File

@@ -23,7 +23,14 @@
# - DropTail queues
# - Tracing of queues and packet receptions to file "udp-echo.tr"
from ns import ns
try:
from ns import ns
except ModuleNotFoundError:
raise SystemExit(
"Error: ns3 Python module not found;"
" Python bindings may not be enabled"
" or your PYTHONPATH might not be properly configured"
)
def main(argv):
#

View File

@@ -27,7 +27,14 @@
# router
#
from ns import ns
try:
from ns import ns
except ModuleNotFoundError:
raise SystemExit(
"Error: ns3 Python module not found;"
" Python bindings may not be enabled"
" or your PYTHONPATH might not be properly configured"
)
def main(argv):

View File

@@ -13,7 +13,14 @@
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# */
from ns import ns
try:
from ns import ns
except ModuleNotFoundError:
raise SystemExit(
"Error: ns3 Python module not found;"
" Python bindings may not be enabled"
" or your PYTHONPATH might not be properly configured"
)
# // Default Network Topology
# //

View File

@@ -16,7 +16,14 @@
# * Ported to Python by Mohit P. Tahiliani
# */
from ns import ns
try:
from ns import ns
except ModuleNotFoundError:
raise SystemExit(
"Error: ns3 Python module not found;"
" Python bindings may not be enabled"
" or your PYTHONPATH might not be properly configured"
)
import sys
# // Default Network Topology

View File

@@ -16,7 +16,14 @@
# * Ported to Python by Mohit P. Tahiliani
# */
from ns import ns
try:
from ns import ns
except ModuleNotFoundError:
raise SystemExit(
"Error: ns3 Python module not found;"
" Python bindings may not be enabled"
" or your PYTHONPATH might not be properly configured"
)
import sys
# // Default Network Topology

View File

@@ -51,7 +51,14 @@
# +----------------+ +----------------+
#
from ns import ns
try:
from ns import ns
except ModuleNotFoundError:
raise SystemExit(
"Error: ns3 Python module not found;"
" Python bindings may not be enabled"
" or your PYTHONPATH might not be properly configured"
)
# #
# # This function will be used below as a trace sink

View File

@@ -22,7 +22,14 @@
import sys
from ns import ns
try:
from ns import ns
except ModuleNotFoundError:
raise SystemExit(
"Error: ns3 Python module not found;"
" Python bindings may not be enabled"
" or your PYTHONPATH might not be properly configured"
)
# void
# DevTxTrace (std::string context, Ptr<const Packet> p, Mac48Address address)