netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Garver <eric@garver.life>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
	Shekhar Sharma <shekhar250198@gmail.com>,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft v4] tests: py: fix python3
Date: Tue, 28 May 2019 09:39:17 -0400	[thread overview]
Message-ID: <20190528133904.3hryyj4g55ewl5sw@egarver.localdomain> (raw)
In-Reply-To: <20190528133206.swz6y52fc7c2pp2c@egarver.localdomain>

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.

  reply	other threads:[~2019-05-28 13:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 18:26 [PATCH nft v4] tests: py: fix python3 Shekhar Sharma
2019-05-23 19:10 ` Eric Garver
2019-05-24 19:36 ` Pablo Neira Ayuso
2019-05-24 19:46   ` Pablo Neira Ayuso
2019-05-28 13:32     ` Eric Garver
2019-05-28 13:39       ` Eric Garver [this message]
2019-05-28 14:03         ` shekhar sharma
2019-05-29  7:37       ` Pablo Neira Ayuso
2019-05-30 21:52         ` Eric Garver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190528133904.3hryyj4g55ewl5sw@egarver.localdomain \
    --to=eric@garver.life \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=shekhar250198@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).