projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
103eff4
)
Merge branch 'fix-stringio-python2.7' of git://github.com/aelse/collectd
author
Florian Forster
<octo@collectd.org>
Wed, 3 Jul 2013 16:21:08 +0000
(18:21 +0200)
committer
Florian Forster
<octo@collectd.org>
Wed, 3 Jul 2013 16:21:08 +0000
(18:21 +0200)
contrib/collectd_network.py
patch
|
blob
|
history
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
-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