From: Tony Jones <tonyj@suse.de>
To: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>,
peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
alexander.shishkin@linux.intel.com, jolsa@redhat.com,
namhyung@kernel.org, linux-kernel@vger.kernel.org,
ravi.bangoria@linux.ibm.com
Subject: Re: [PATCH v3] perf scripts python: Add Python 3 support to export-to-sqlite.py
Date: Mon, 21 Jan 2019 09:38:11 -0800 [thread overview]
Message-ID: <a9fea5f9-752d-e069-bd17-31fabe258a20@suse.de> (raw)
In-Reply-To: <1548067157-10395-1-git-send-email-s1seetee@linux.vnet.ibm.com>
On 1/21/19 2:39 AM, Seeteena Thoufeek wrote:
> Support both Python 2 and Python 3 in export-to-sqlite.py. ``print`` is
> now a function rather than a statement. This should have no functional
> change.
>
> Also, handles the conversion of "print >> sys.stderr".
>
> Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
> Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
> tools/perf/scripts/python/export-to-sqlite.py | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py
> index 245caf2..95bfcb2 100644
> --- a/tools/perf/scripts/python/export-to-sqlite.py
> +++ b/tools/perf/scripts/python/export-to-sqlite.py
> @@ -9,6 +9,7 @@
> # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> # more details.
> +from __future__ import print_function
So is the script failing for you without the above
As I said in previous reviews you should not need this unless you are using features of the latest print function (end, sep etc). You will need this import in the other scripts (once you fix the numerous errors regarding the trailing comma usage) as some need to concatenate output onto one line but I don't think you need it here.
tony
$ python2 --version
Python 2.7.15
$ python3 --version
Python 3.6.5
$ a='print("abcd") ; print("defg")'
$ echo $a | python2
abcd
defg
$ echo $a | python3
abcd
defg
$ b='print("abcd", end="") ; print("defg")'
$ echo $b | python2
File "<stdin>", line 1
print("abcd", end="") ; print("defg")
^
SyntaxError: invalid syntax
$ echo $b | python3
abcddefg
$ c='from __future__ import print_function ; print("abcd", end="") ; print("defg")'
$ echo $c | python2
abcddefg
$ echo $c | python3
abcddefg
prev parent reply other threads:[~2019-01-21 17:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 10:39 Seeteena Thoufeek
2019-01-21 17:38 ` Tony Jones [this message]
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=a9fea5f9-752d-e069-bd17-31fabe258a20@suse.de \
--to=tonyj@suse.de \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@linux.ibm.com \
--cc=s1seetee@linux.vnet.ibm.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
Powered by JetHome