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 7BA5BA317C for ; Thu, 17 Oct 2019 19:32:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F239C1E8CA; Thu, 17 Oct 2019 19:32:20 +0200 (CEST) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by dpdk.org (Postfix) with ESMTP id 2DA8F1E540 for ; Thu, 17 Oct 2019 19:32:19 +0200 (CEST) Received: by mail-wr1-f43.google.com with SMTP id r5so3276530wrm.12 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=SQbwdmzmkvkZetXegOoMG2Vv0d2uSO924AosuIBkpS5tcY3kUPxfDFU4paNKTSS/JK 8+pLiWjGmB+TP8KwvvAlZMgHm9aW/qfDrB7S97AqMswfU79pob2dQXIzhTHT3NO6RTiO CeJZznX5QWp/QZY5tSH59q4G9uIEwjgbwgHCV5DA065u7c9BijCaaCfJ5TExt1DogVmN kp4xPJO9SLHjIugMKN4pbf/nEQfcFAmw0GLEfgQSevS6JcCaEfSx/RPH6iFfSv+Jzn3o PFKuSmNQh4K5elZBNkijiOUXcmSd+WkkOBI0ydYdnFgAY8zQq/rXkfbHSBmr37iW+BX2 JgkQ== X-Gm-Message-State: APjAAAV/dnUN/2yktKVGgYON2SSK5MNfElXvw2uh2XiQD8eBsLJOiToh vugxbjobuBWPcJoIlw3V6oHn4g== 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-dev] [PATCH] usertools: fix py3 syntax errors with dpdk-telemetry-client.py X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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