Description: A Python script is the terrific defined as a Python file that holds commands in a sequentially logical order. The python program should do something really and anything when it sprint through the Python interpreter. It is commonly used to evolve task automation, data analysis, data visualization, websites, and software. To compile a python script in mininet, make sure that it automatically compiles all Python files using the compile all module. Users can also do it from the shell prompt by running compile all.py, providing the path of the directory holding the Python files to compile.
Follow the given sample and procedure discussed below in a given section that how to Compile a Python Script with Mininet.
If you like to create custom topologies with Mininet, then you can use python scripts.
So, to compile python scripts on Mininet, first, type the command mentioned below to check whether you have python ide
Python
If you see something python version such as python 3.6.5 or any other version, that means you have a python ide
To exit from python-mode
Quit()
Note: that the commands that you use in the Linux terminal are also applicable in the Mininet terminal
Let us create a folder for python scripts
mkdir Mininet_scripts
Get in the directory or folder Mininet_scripts
cd Mininet_scripts
Create a python file and edit it
cat>simple_python_script.py
Type your python script
print(“this is just a simple script to test”)
Save and exit the python program with a short key Ctrl+d
Compile the python script
Sudo python simple_python_script.py
If you like to edit the saved program, then you can do it by using the below command