[dpdk-users] SyntaxError in setup.sh during binding ethernet device
W dniu 2016-01-27 14:48:05 u?ytkownik Thomas Monjalon napisa?: > 2016-01-27 14:44, dawid_jurek: > > W dniu 2016-01-19 11:54:24 u?ytkownik dawid_jurek > > napisa?: > > > > > > > > > W dniu 2016-01-19 11:19:55 u?ytkownik Thomas Monjalon > > 6wind.com> napisa?: > > > > Hi > > > > > > > > 2016-01-19 10:45, dawid_jurek: > > > > > Hello DPDK developers, > > > > > I experienced issue when I ran tools/setup.sh and chose option [23]: > > > > > Bind Ethernet device to IGB UIO module. > > > > > Script Output: > > > > > File ".../dpdk/dpdk-2.2.0/tools/dpdk_nic_bind.py", line 113 > > > > > """ % locals() # replace items from local variables > > > > > ^ > > > > > SyntaxError: invalid syntax > > > > > It turned out that python 2.7 set as default in system was needed. > > > > > So I added python2 to every line with dpdk_nic_bind.py call in > > > > > tools/setup.sh and now it works fine. > > > > > But the question is: is it expected behaviour? Shouldn't it be fixed > > > > > by simple patch in way I did it? > > > > > > > > Yes a patch would be appreciated to make it python 3 friendly. > > > > Thanks > > > > > > > > > > OK. I will prepare patch for dpdk_nic_bind.py soon. > > > Regards, > > > Dawid > > > > > > > > > > Hello again, > > patch for this issue was prepared and tested on Arch (Python 3 is default) > > and Ubuntu (Python 2 is default) distros. > > In both cases syntax errors from dpdk_nic_bind.py disappeared and > > everything worked as expected. > > Patch is very simple and in most cases just adds extra brackets to print > > functions. > > Anyway please review this. > > It looks simple and good. > Please could you send it on dev at dpdk.org? > The procedure is described here: > http://dpdk.org/dev#send > and detailed here: > http://dpdk.org/doc/guides/contributing/patches.html > > Thanks > Done. Available here: http://dpdk.org/ml/archives/dev/2016-January/032148.html Regards, Dawid
[dpdk-users] SyntaxError in setup.sh during binding ethernet device
2016-01-27 14:44, dawid_jurek: > W dniu 2016-01-19 11:54:24 u?ytkownik dawid_jurek > napisa?: > > > > > > W dniu 2016-01-19 11:19:55 u?ytkownik Thomas Monjalon > 6wind.com> napisa?: > > > Hi > > > > > > 2016-01-19 10:45, dawid_jurek: > > > > Hello DPDK developers, > > > > I experienced issue when I ran tools/setup.sh and chose option [23]: > > > > Bind Ethernet device to IGB UIO module. > > > > Script Output: > > > > File ".../dpdk/dpdk-2.2.0/tools/dpdk_nic_bind.py", line 113 > > > > """ % locals() # replace items from local variables > > > > ^ > > > > SyntaxError: invalid syntax > > > > It turned out that python 2.7 set as default in system was needed. > > > > So I added python2 to every line with dpdk_nic_bind.py call in > > > > tools/setup.sh and now it works fine. > > > > But the question is: is it expected behaviour? Shouldn't it be fixed by > > > > simple patch in way I did it? > > > > > > Yes a patch would be appreciated to make it python 3 friendly. > > > Thanks > > > > > > > OK. I will prepare patch for dpdk_nic_bind.py soon. > > Regards, > > Dawid > > > > > > Hello again, > patch for this issue was prepared and tested on Arch (Python 3 is default) > and Ubuntu (Python 2 is default) distros. > In both cases syntax errors from dpdk_nic_bind.py disappeared and everything > worked as expected. > Patch is very simple and in most cases just adds extra brackets to print > functions. > Anyway please review this. It looks simple and good. Please could you send it on dev at dpdk.org? The procedure is described here: http://dpdk.org/dev#send and detailed here: http://dpdk.org/doc/guides/contributing/patches.html Thanks
[dpdk-users] SyntaxError in setup.sh during binding ethernet device
W dniu 2016-01-19 11:54:24 u?ytkownik dawid_jurek napisa?: > > > W dniu 2016-01-19 11:19:55 u?ytkownik Thomas Monjalon 6wind.com> napisa?: > > Hi > > > > 2016-01-19 10:45, dawid_jurek: > > > Hello DPDK developers, > > > I experienced issue when I ran tools/setup.sh and chose option [23]: Bind > > > Ethernet device to IGB UIO module. > > > Script Output: > > > File ".../dpdk/dpdk-2.2.0/tools/dpdk_nic_bind.py", line 113 > > > """ % locals() # replace items from local variables > > > ^ > > > SyntaxError: invalid syntax > > > It turned out that python 2.7 set as default in system was needed. > > > So I added python2 to every line with dpdk_nic_bind.py call in > > > tools/setup.sh and now it works fine. > > > But the question is: is it expected behaviour? Shouldn't it be fixed by > > > simple patch in way I did it? > > > > Yes a patch would be appreciated to make it python 3 friendly. > > Thanks > > > > OK. I will prepare patch for dpdk_nic_bind.py soon. > Regards, > Dawid > > Hello again, patch for this issue was prepared and tested on Arch (Python 3 is default) and Ubuntu (Python 2 is default) distros. In both cases syntax errors from dpdk_nic_bind.py disappeared and everything worked as expected. Patch is very simple and in most cases just adds extra brackets to print functions. Anyway please review this. Regards, Dawid diff --git a/tools/dpdk_nic_bind.py b/tools/dpdk_nic_bind.py index f02454e..9f7c848 100755 --- a/tools/dpdk_nic_bind.py +++ b/tools/dpdk_nic_bind.py @@ -54,7 +54,7 @@ args = [] def usage(): '''Print usage information for the program''' argv0 = basename(sys.argv[0]) -print """ +print (""" Usage: -- @@ -110,7 +110,7 @@ To unbind :01:00.0 from using any driver To bind :02:00.0 and :02:00.1 to the ixgbe kernel driver %(argv0)s -b ixgbe 02:00.0 02:00.1 -""" % locals() # replace items from local variables +""" % locals()) # replace items from local variables # This is roughly compatible with check_output function in subprocess module # which is only available in python 2.7. @@ -156,7 +156,7 @@ def check_modules(): '''Checks that igb_uio is loaded''' global dpdk_drivers -fd = file("/proc/modules") +fd = open("/proc/modules", 'r') loaded_mods = fd.readlines() fd.close() @@ -176,10 +176,10 @@ def check_modules(): # check if we have at least one loaded module if True not in [mod["Found"] for mod in mods] and b_flag is not None: if b_flag in dpdk_drivers: -print "Error - no supported modules(DPDK driver) are loaded" +print ("Error - no supported modules(DPDK driver) are loaded") sys.exit(1) else: -print "Warning - no supported modules(DPDK driver) are loaded" +print ("Warning - no supported modules(DPDK driver) are loaded") # change DPDK driver list to only contain drivers that are loaded dpdk_drivers = [mod["Name"] for mod in mods if mod["Found"]] @@ -198,7 +198,7 @@ def get_pci_device_details(dev_id): for line in extra_info: if len(line) == 0: continue -name, value = line.split("\t", 1) +name, value = line.decode().split("\t", 1) name = name.strip(":") + "_str" device[name] = value # check for a unix interface name @@ -234,7 +234,7 @@ def get_nic_details(): dev["Device"] = int(dev["Device"],16) devices[dev["Slot"]] = dict(dev) # use dict to make copy of dev else: -name, value = dev_line.split("\t", 1) +name, value = dev_line.decode().split("\t", 1) dev[name.rstrip(":")] = value # check what is the interface if any for an ssh connection if @@ -243,17 +243,17 @@ def get_nic_details(): route = check_output(["ip", "-o", "route"]) # filter out all lines for 169.254 routes route = "\n".join(filter(lambda ln: not ln.startswith("169.254"), - route.splitlines())) + route.decode().splitlines())) rt_info = route.split() -for i in xrange(len(rt_info) - 1): +for i in range(len(rt_info) - 1): if rt_info[i] == "dev": ssh_if.append(rt_info[i+1]) # based on the basic info, get extended text details for d in devices.keys(): # get additional info and add it to existing data -devices[d] = dict(devices[d].items() + - get_pci_device_details(d).items()) +devices[d] = devices[d].copy() +devices[d].update(get_pci_device_details(d).items()) for _if in ssh_if: if _if in devices[d]["Interface"].split(","): @@ -293,22 +293,22 @@ def dev_id_from_dev_name(dev_name): if dev_name in devices[d]["Interface"].split(","): return devices[d]["Slot"] # if nothing else matches - error -print "Unknown device: %s. " \ -"Please specify
[dpdk-users] SyntaxError in setup.sh during binding ethernet device
W dniu 2016-01-19 11:19:55 u?ytkownik Thomas Monjalon napisa?: > Hi > > 2016-01-19 10:45, dawid_jurek: > > Hello DPDK developers, > > I experienced issue when I ran tools/setup.sh and chose option [23]: Bind > > Ethernet device to IGB UIO module. > > Script Output: > > File ".../dpdk/dpdk-2.2.0/tools/dpdk_nic_bind.py", line 113 > > """ % locals() # replace items from local variables > > ^ > > SyntaxError: invalid syntax > > It turned out that python 2.7 set as default in system was needed. > > So I added python2 to every line with dpdk_nic_bind.py call in > > tools/setup.sh and now it works fine. > > But the question is: is it expected behaviour? Shouldn't it be fixed by > > simple patch in way I did it? > > Yes a patch would be appreciated to make it python 3 friendly. > Thanks > OK. I will prepare patch for dpdk_nic_bind.py soon. Regards, Dawid
[dpdk-users] SyntaxError in setup.sh during binding ethernet device
Hi 2016-01-19 10:45, dawid_jurek: > Hello DPDK developers, > I experienced issue when I ran tools/setup.sh and chose option [23]: Bind > Ethernet device to IGB UIO module. > Script Output: > File ".../dpdk/dpdk-2.2.0/tools/dpdk_nic_bind.py", line 113 > """ % locals() # replace items from local variables > ^ > SyntaxError: invalid syntax > It turned out that python 2.7 set as default in system was needed. > So I added python2 to every line with dpdk_nic_bind.py call in tools/setup.sh > and now it works fine. > But the question is: is it expected behaviour? Shouldn't it be fixed by > simple patch in way I did it? Yes a patch would be appreciated to make it python 3 friendly. Thanks
[dpdk-users] SyntaxError in setup.sh during binding ethernet device
Hello DPDK developers, I experienced issue when I ran tools/setup.sh and chose option [23]: Bind Ethernet device to IGB UIO module. Script Output: File ".../dpdk/dpdk-2.2.0/tools/dpdk_nic_bind.py", line 113 ??? """ % locals() # replace items from local variables ? ^ SyntaxError: invalid syntax It turned out that python 2.7 set as default in system was needed. So I added python2 to every line with dpdk_nic_bind.py call in tools/setup.sh and now it works fine. But the question is: is it expected behaviour? Shouldn't it be fixed by simple patch in way I did it? ? Regards, Dawid