mirror of https://github.com/nicolargo/glances
Ports plugin crashs on start with Python 3 (issue#918)
parent
55346cd18d
commit
cc9e7adbbf
|
@ -24,6 +24,7 @@
|
|||
import operator
|
||||
import sys
|
||||
import unicodedata
|
||||
import types
|
||||
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
|
@ -47,6 +48,7 @@ if PY3:
|
|||
|
||||
text_type = str
|
||||
binary_type = bytes
|
||||
bool_type = bool
|
||||
|
||||
viewkeys = operator.methodcaller('keys')
|
||||
viewvalues = operator.methodcaller('values')
|
||||
|
@ -96,6 +98,7 @@ else:
|
|||
|
||||
text_type = unicode
|
||||
binary_type = str
|
||||
bool_type = types.BooleanType
|
||||
|
||||
viewkeys = operator.methodcaller('viewkeys')
|
||||
viewvalues = operator.methodcaller('viewvalues')
|
||||
|
|
|
@ -29,6 +29,7 @@ import time
|
|||
from glances.globals import WINDOWS
|
||||
from glances.ports_list import GlancesPortsList
|
||||
from glances.timer import Timer, Counter
|
||||
from glances.compat import bool_type
|
||||
from glances.logger import logger
|
||||
from glances.plugins.glances_plugin import GlancesPlugin
|
||||
|
||||
|
@ -116,7 +117,7 @@ class Plugin(GlancesPlugin):
|
|||
for p in self.stats:
|
||||
if p['status'] is None:
|
||||
status = 'Scanning'
|
||||
elif isinstance(p['status'], types.BooleanType) and p['status'] is True:
|
||||
elif isinstance(p['status'], bool_type) and p['status'] is True:
|
||||
status = 'Open'
|
||||
elif p['status'] == 0:
|
||||
status = 'Timeout'
|
||||
|
|
Loading…
Reference in New Issue