projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make node_handler_fetch_data() stateless
[collectd.git]
/
contrib
/
collectd_network.py
diff --git
a/contrib/collectd_network.py
b/contrib/collectd_network.py
index
dc6cdac
..
809f19d
100644
(file)
--- a/
contrib/collectd_network.py
+++ b/
contrib/collectd_network.py
@@
-17,10
+17,15
@@
Collectd network protocol implementation.
"""
import socket,struct,sys
"""
import socket,struct,sys
-try:
- from io import StringIO
-except ImportError:
- from cStringIO import StringIO
+import platform
+if platform.python_version() < '2.8.0':
+ # Python 2.7 and below io.StringIO does not like unicode
+ from StringIO import StringIO
+else:
+ try:
+ from io import StringIO
+ except ImportError:
+ from cStringIO import StringIO
from datetime import datetime
from copy import deepcopy
from datetime import datetime
from copy import deepcopy