Re: [PATCH nft v4] tests: py: fix python3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 28, 2019 at 09:32:06AM -0400, Eric Garver wrote:
> On Fri, May 24, 2019 at 09:46:05PM +0200, Pablo Neira Ayuso wrote:
> > On Fri, May 24, 2019 at 09:36:00PM +0200, Pablo Neira Ayuso wrote:
> > > On Thu, May 23, 2019 at 11:56:22PM +0530, Shekhar Sharma wrote:
> > > > This version of the patch converts the file into python3 and also uses
> > > > .format() method to make the print statments cleaner.
> > > 
> > > Applied, thanks.
> > 
> > Hm.
> > 
> > I'm hitting this here after applying this:
> > 
> > # python nft-test.py
> > Traceback (most recent call last):
> >   File "nft-test.py", line 17, in <module>
> >     from nftables import Nftables
> > ImportError: No module named nftables
> 
> Did you build nftables --with-python-bin ? The error can occur if you
> built nftables against a different python version. e.g. built for
> python3, but the "python" executable is python2.

Actually, it's probably caused by this hunk:

    @@ -13,6 +13,8 @@
     # Thanks to the Outreach Program for Women (OPW) for sponsoring this test
     # infrastructure.

    +from __future__ import print_function
    +from nftables import Nftables
     import sys
     import os
     import argparse
    @@ -22,7 +24,6 @@ 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

     TESTS_DIRECTORY = ["any", "arp", "bridge", "inet", "ip", "ip6"]
     LOGFILE = "/tmp/nftables-test.log"

I don't know why the import of nftables was moved. But it was moved to
_before_ the modification of the import search path (sys.path.insert()).
Moving it back should fix the issue. Sorry I missed it.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux