Hi llya, Pls find the comments inline.
> -----Original Message----- > From: Ilya Maximets <[email protected]> > Sent: Monday, July 19, 2021 4:07 PM > To: Ilya Maximets <[email protected]>; Amber, Kumar > <[email protected]>; [email protected] > Cc: Stokes, Ian <[email protected]> > Subject: Re: [PATCH v1] tests: fix python2 module not find error > > On 7/19/21 12:35 PM, Ilya Maximets wrote: > > On 7/17/21 5:21 AM, Amber, Kumar wrote: > >> Hi llya, > >> > >> This is what I get after a minor tweek : > >> "except ImportError as err: > >> print(err)" > >> > >> when Scapy is not present : > >> > >> No module named 'scapy' > >> Traceback (most recent call last): > >> File "./../mfex_fuzzy.py", line 10, in <module> > >> pktdump = PcapWriter(path, append=False, sync=True) > >> NameError: name 'PcapWriter' is not defined > >> > >> Is this ohk ? > > > > I don't understand why we're catching this exception. > > Even with your changes if the package is not available, we will catch > > the ImportError, print it and go further, later while trying to use > > modules that wasn't imported we will get another more vague exception. > > So what is the port catching ImportError in the first place? > > s/port/point/ > > > > > If we'll exit after printing... well, but doesn't python print > > exception trace by itself? > > > > BTW, the title of this patch is incorrect. We do not support python2, > > this problem is with python3 < 3.6. Yes makes sense now logs are very clear we don’t need the try and catch block at all removed in the patch And fixed the heading . Traceback (most recent call last): File "./mfex_fuzzy.py", line 2, in <module> from scapy.all import RandMAC, RandIP, PcapWriter, RandIP6, RandShort, fuzz ModuleNotFoundError: No module named 'scapy > > > > Best regards, Ilya Maximets. > > > >> > >> Regards > >> Amber > >> > >> > >>> -----Original Message----- > >>> From: Ilya Maximets <[email protected]> > >>> Sent: Saturday, July 17, 2021 12:21 AM > >>> To: Amber, Kumar <[email protected]>; [email protected] > >>> Cc: [email protected]; Stokes, Ian <[email protected]> > >>> Subject: Re: [PATCH v1] tests: fix python2 module not find error > >>> > >>> On 7/16/21 8:15 PM, kumar Amber wrote: > >>>> This fixes the flake8 error on pyhton version older than 3.6 as > >>>> ModuleNotFoundError in not available before 3.6 and that is now > >>>> replaced to ImportError which is present in earlier versions. > >>>> > >>>> ../../tests/mfex_fuzzy.py:5:8: F821 undefined name > 'ModuleNotFoundError' > >>>> 2653Makefile:5826: recipe for target 'flake8-check' failed > >>>> > >>>> Fixes: 50be6715c0 ("test/sytem-dpdk: Add unit test for mfex > >>>> autovalidator") > >>>> Signed-off-by: kumar Amber <[email protected]> > >>>> --- > >>>> tests/mfex_fuzzy.py | 2 +- > >>>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>>> > >>>> diff --git a/tests/mfex_fuzzy.py b/tests/mfex_fuzzy.py index > >>>> 5b056bb48..fd257ffb6 100755 > >>>> --- a/tests/mfex_fuzzy.py > >>>> +++ b/tests/mfex_fuzzy.py > >>>> @@ -2,7 +2,7 @@ > >>>> try: > >>>> from scapy.all import RandMAC, RandIP, PcapWriter, RandIP6, > >>>> RandShort, > >>> fuzz > >>>> from scapy.all import IPv6, Dot1Q, IP, Ether, UDP, TCP -except > >>>> ModuleNotFoundError as err: > >>>> +except ImportError as err: > >>>> print(err + ": Scapy") > >>>> import sys > >>>> > >>>> > >>> > >>> I can confirm that this fixes the flake8 issue. > >>> > >>> But I'm not sure how that is supposed to work at all. > >>> Here is what I get in a plain python console: > >>> > >>> Python 3.6.8 (default, Mar 18 2021, 08:58:41) [GCC 8.4.1 20200928 > >>> (Red Hat 8.4.1-1)] on linux Type "help", "copyright", "credits" or > >>> "license" for more information. > >>>>>> try: > >>> ... from scapy.all import RandMAC > >>> ... except ImportError as err: > >>> ... print(err + ": Scapy") > >>> ... > >>> Traceback (most recent call last): > >>> File "<stdin>", line 2, in <module> > >>> ModuleNotFoundError: No module named 'scapy' > >>> > >>> During handling of the above exception, another exception occurred: > >>> > >>> Traceback (most recent call last): > >>> File "<stdin>", line 4, in <module> > >>> TypeError: unsupported operand type(s) for +: 'ModuleNotFoundError' and > 'str' > >>> > >>> > >>> Best regards, Ilya Maximets. > > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
