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

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

 



On Wed, May 29, 2019 at 09:37:02AM +0200, Pablo Neira Ayuso wrote:
> 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.
> 
> Thanks for explaining.
> 
> When running:
> 
>         ./configure --help
> 
> it shows this:
> 
>   --enable-python         Enable python
> 
> If I use it, I get this:
> 
> nft configuration:
>   cli support:                  yes
>   enable debugging symbols:     yes
>   use mini-gmp:                 no
>   enable man page:              yes
>   libxtables support:           yes
>   json output support:          yes
>   enable Python:                yes (with yes) <------
> 
> $ make
> ...
> setup.py build --build-base /home/pablo/devel/scm/git-netfilter/nftables/py
> setup.py build --build-base /home/pablo/devel/scm/git-netfilter/nftables/py
> setup.py build --build-base /home/pablo/devel/scm/git-netfilter/nftables/py
> ...
> (forever loop)
> 
> so it indeed uses 'yes' :-)
> 
> same effect in case I specify --with-python-bin with no path, ie.
> 
> ./configure --with-python-bin --with-xtables --enable-python --with-json

It was found in another thread that the error you see is caused by an
issue in the patch.

That being said..

--with-python-bin is to specify the interpreter. So you need to pass it
something like /usr/bin/python2 or /usr/bin/python3. By default
configure will autodetect - I think it prefers python2.

e.g.

    $ ./configure --enable-python --with-python-bin=/usr/bin/python3



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

  Powered by Linux