mirror of
https://github.com/openvswitch/ovs
synced 2025-09-04 08:15:25 +00:00
python: Fix print function compatibility.
The print statement from Python 2 is a function in Python 3. Enable print function support for Python 2 and convert print statements to function calls. Enable the H233 flake8 warning. If the hacking plugin is installed, this will generate warnings for print statement usage not compatible with Python 3. H233 Python 3.x incompatible use of print operator Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import codecs
|
||||
import getopt
|
||||
import sys
|
||||
@@ -21,7 +23,7 @@ import ovs.json
|
||||
|
||||
def print_json(json):
|
||||
if type(json) in [str, unicode]:
|
||||
print "error: %s" % json
|
||||
print("error: %s" % json)
|
||||
return False
|
||||
else:
|
||||
ovs.json.to_stream(json, sys.stdout)
|
||||
|
Reference in New Issue
Block a user