omergertel / pyformance

Performance metrics, based on Coda Hale's Yammer metrics
Other
195 stars 72 forks source link

Fix import of hosted_graphite_reporter.py for python >= 3.5 #57

Closed yassFar closed 5 years ago

yassFar commented 6 years ago

This PR fix an ImportError for hosted_graphite_reporter.py wiht python >= 3.5:

>>> import pyformance.reporters.hosted_graphite_reporter Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/yfaris/dev/opcdaproxy/.env3/lib/python3.5/site-packages/pyformance/reporters/hosted_graphite_reporter.py", line 4, in <module> import urllib2 ImportError: No module named 'urllib2'

This PR also change the method used to handle different import between different python version with a simpler one using the six.moves module.

yassFar commented 6 years ago

And replace relative import with absolute import:

File "/home/yfaris/dev/opcdaproxy/.env/local/lib/python2.7/site-packages/pyformance/reporters/hosted_graphite_reporter.py", line 7, in <module> from .meters import Counter, Histogram, Meter, Timer ImportError: No module named meters

yassFar commented 6 years ago

Launched the test with python 3.6 on my machine, all test passed.

omergertel commented 5 years ago

Closing for inactivity