From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E0A8FA317C for ; Thu, 17 Oct 2019 19:32:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C219B1E53A; Thu, 17 Oct 2019 19:32:20 +0200 (CEST) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by dpdk.org (Postfix) with ESMTP id 28AF51E53A for ; Thu, 17 Oct 2019 19:32:19 +0200 (CEST) Received: by mail-wr1-f42.google.com with SMTP id o15so2872325wru.5 for ; Thu, 17 Oct 2019 10:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nFMSZatH+hh4rAxlY4ZidPNfjxjzaGAFDvgIvBw9qog=; b=GrjmYkJWOWmA4jV7Gb7/fhmjgrQ8SuxpODlwNPYVJS9dXEybJtfM6t3B9WRIpV6J8o Qe9qU9xh4zrJsR238Oq6zAoxkta9AVsx+hc2uv0znwvM8krc+GgTJuZaz0bto1epeh8h diYu3KHdto+wUBuh1+3820FG+eDaQSx4MJjYkWA9okRw+vmpQFPVh4MerBjV2uf81Z3z RzoVRlom34tztTJwfFzzk+e1qH3aQEhkP+MCWFVMrNSAnaOjE+/qznqJKFS/XfDjNAep UaYelnMK+fM6O3+qECfETiyE8F/u0FV5N1DsbemysMxCeRXL0CF0hLZIyUnWfneXWfmJ KvsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nFMSZatH+hh4rAxlY4ZidPNfjxjzaGAFDvgIvBw9qog=; b=m46dIL23vCMzwcMxfKSNGD9f3HflvY3Xr4AUBIWSrY6/r7LR+yburTPJP7AyDRpJUW jCeD+W9T4UDkA6srtpDP1ZVhkKMvwY+agqMpDceB5LH/rEV7CfiN41iu221jINU8FgN1 cmoPHkIynhzlS86nKIwyFqdhKwzgtFXndvHX906gyCD4S/tSSOhdu7HE5SZWixyqAEBs 9wkKsnH5zbB3bmJYnitpGUGdfoypMoOQrVrxjn5QY2zo8Ozd4qXnJr6mTWwpBTuf499B 1rJ29UdTR8NCRVYuhldnA8MxHysVt5I9tiTUsFynaCi5U/TsBfof6T54hO+CRsk+EmLN CYhQ== X-Gm-Message-State: APjAAAVZVBoWqkzXE9TedQBh0fBxKfgUF2o1FLf4JKuFEl7oRW3Cyxgx fz7M5o6l1fsce2N2Q2IaDeav6g== X-Google-Smtp-Source: APXvYqwCQBijrAWWaBqNVY/X5kcrFHt6Z97i5kEH3FgxH5g/b0Vk+dplq3+abBRKUkKDbssYpjPP4A== X-Received: by 2002:a5d:5270:: with SMTP id l16mr4084172wrc.201.1571333538801; Thu, 17 Oct 2019 10:32:18 -0700 (PDT) Received: from tom.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 3sm2644948wmo.22.2019.10.17.10.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 10:32:18 -0700 (PDT) From: Robin Jarry To: Kevin Laatz Cc: dev@dpdk.org, Andrius Sirvys , Ciara Power , Reshma Pattan , stable@dpdk.org Date: Thu, 17 Oct 2019 19:32:12 +0200 Message-Id: <20191017173212.1038-1-robin.jarry@6wind.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] usertools: fix py3 syntax errors with dpdk-telemetry-client.py X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" When running the dpdk-telemetry-client.py with python 3, we get the following syntax errors: File "usertools/dpdk-telemetry-client.py", line 70 print "\nResponse: \n", str(data) ^ SyntaxError: invalid syntax File "usertools/dpdk-telemetry-client.py", line 93 print "\nResponse: \n", str(data) ^ SyntaxError: invalid syntax File "usertools/dpdk-telemetry-client.py", line 111 file_path = sys.argv[1] ^ TabError: inconsistent use of tabs and spaces in indentation Import print_function from __future__ and add parentheses where missing. Also, use spaces for indentation everywhere. Fixes: d1b94da4a4e0 ("usertools: add client script for telemetry") Fixes: 53f293c9a783 ("usertools: replace unsafe input function") Fixes: 4080e46c8078 ("telemetry: support global metrics") Cc: Andrius Sirvys Cc: Ciara Power Cc: Kevin Laatz Cc: Reshma Pattan Cc: stable@dpdk.org Signed-off-by: Robin Jarry --- usertools/dpdk-telemetry-client.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetry-client.py index 60fe97af79a8..e06d6306cbd5 100755 --- a/usertools/dpdk-telemetry-client.py +++ b/usertools/dpdk-telemetry-client.py @@ -2,6 +2,8 @@ # SPDK-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation +from __future__ import print_function + import socket import os import sys @@ -16,9 +18,9 @@ DEFAULT_FP = "/var/run/dpdk/default_client" try: - raw_input # Python 2 + raw_input # Python 2 except NameError: - raw_input = input # Python 3 + raw_input = input # Python 3 class Socket: @@ -74,7 +76,7 @@ def unregister(self): # Unregister a given client def requestMetrics(self): # Requests metrics for given client self.socket.client_fd.send(METRICS_REQ) data = self.socket.client_fd.recv(BUFFER_SIZE) - print "\nResponse: \n", str(data) + print("\nResponse: \n", str(data)) def repeatedlyRequestMetrics(self, sleep_time): # Recursively requests metrics for given client print("\nPlease enter the number of times you'd like to continuously request Metrics:") @@ -88,7 +90,7 @@ def repeatedlyRequestMetrics(self, sleep_time): # Recursively requests metrics f def requestGlobalMetrics(self): #Requests global metrics for given client self.socket.client_fd.send(GLOBAL_METRICS_REQ) data = self.socket.client_fd.recv(BUFFER_SIZE) - print "\nResponse: \n", str(data) + print("\nResponse: \n", str(data)) def interactiveMenu(self, sleep_time): # Creates Interactive menu within the script while self.choice != 4: @@ -121,10 +123,10 @@ def interactiveMenu(self, sleep_time): # Creates Interactive menu within the scr sleep_time = 1 file_path = "" if (len(sys.argv) == 2): - file_path = sys.argv[1] + file_path = sys.argv[1] else: print("Warning - No filepath passed, using default (" + DEFAULT_FP + ").") - file_path = DEFAULT_FP + file_path = DEFAULT_FP client = Client() client.getFilepath(file_path) client.register() -- 2.23.0