Hi, On Mon, May 27, 2019 at 9:24 PM Phil Sutter <phil@xxxxxx> wrote: > > Hi, > > On Sat, May 25, 2019 at 12:14:09AM +0530, Shekhar Sharma wrote: > > This patch converts the 'run-test.py' file to run on both python2 and python3. > > > > Signed-off-by: Shekhar Sharma <shekhar250198@xxxxxxxxx> > > --- > > tests/json_echo/run-test.py | 45 +++++++++++++++++++------------------ > > 1 file changed, 23 insertions(+), 22 deletions(-) > > > > diff --git a/tests/json_echo/run-test.py b/tests/json_echo/run-test.py > > index 0132b139..f5c81b7d 100755 > > --- a/tests/json_echo/run-test.py > > +++ b/tests/json_echo/run-test.py > > @@ -1,5 +1,7 @@ > > #!/usr/bin/python2 > > If the script now runs with either python 2 or 3, maybe change the > shebang to just '/usr/bin/python'? > Yes, will change it to 'usr/bin/python' in the next patch. > > +from nftables import Nftables > > +from __future__ import print_function > > import sys > > import os > > import json > > @@ -7,14 +9,13 @@ import json > > TESTS_PATH = os.path.dirname(os.path.abspath(__file__)) > > sys.path.insert(0, os.path.join(TESTS_PATH, '../../py/')) > > > > -from nftables import Nftables > > Are you aware that the import was put here deliberately after the call > to sys.path.insert()? Why did you decide to move the import call? > I was not aware of that. I just thought that every 'from __ import __ ' statement should be written before 'import __' statements :-) . Will change it. > > # Change working directory to repository root > > os.chdir(TESTS_PATH + "/../..") > > > > if not os.path.exists('src/.libs/libnftables.so'): > > - print "The nftables library does not exist. " \ > > - "You need to build the project." > > + print("The nftables library does not exist. " \ > > + "You need to build the project.") > > sys.exit(1) > > Drop the backslash here? > Yes, will do that. > Cheers, Phil Will do the necessary changes. Thanks! Shekhar