On 1/17/19 1:45 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.

I don't see any changes handling the following:

$ git annotate tools/perf/scripts/python/export-to-sqlite.py | grep ">> sys"
564b9527d1ccf   (Adrian Hunter  2017-08-03 11:31:28 +0300       64)     print 
>> sys.stderr, "Usage is: export-to-sqlite.py <database name> [<columns>] 
[<calls>] [<callchains>]"
564b9527d1ccf   (Adrian Hunter  2017-08-03 11:31:28 +0300       65)     print 
>> sys.stderr, "where:    columns         'all' or 'branches'"
564b9527d1ccf   (Adrian Hunter  2017-08-03 11:31:28 +0300       66)     print 
>> sys.stderr, "          calls           'calls' => create calls and 
call_paths table"
564b9527d1ccf   (Adrian Hunter  2017-08-03 11:31:28 +0300       67)     print 
>> sys.stderr, "          callchains      'callchains' => create call_paths 
table"

$ echo 'import sys ; print >> sys.stderr, "Usage is: exported-sql-viewer.py 
{<database name> | --help-only}"' | python2
Usage is: exported-sql-viewer.py {<database name> | --help-only}

$ echo 'import sys ; print >> sys.stderr, "Usage is: exported-sql-viewer.py 
{<database name> | --help-only}"' | python3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for >>: 'builtin_function_or_method' and 
'_io.TextIOWrapper'. Did you mean "print(<message>, file=<output_stream>)"?


They are best handled via conversion to sys.stderr.write() since sys is already 
imported.

Tony

Reply via email to