From f994c4d1dae8fed7d12f037304a6f3a31b9f68a9 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 10 May 2016 13:48:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(connect.py)=20=E4=BF=AE=E5=A4=8Dmax?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 已经修复 --- connect.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/connect.py b/connect.py index ac8010c32..8e138c6c5 100755 --- a/connect.py +++ b/connect.py @@ -518,7 +518,10 @@ class Nav(object): @staticmethod def get_max_asset_property_length(assets, property_='hostname'): - return max([len(getattr(asset, property_)) for asset in assets]) + try: + return max([len(getattr(asset, property_)) for asset in assets]) + except ValueError: + return 30 def print_search_result(self): hostname_max_length = self.get_max_asset_property_length(self.search_result)