Third party pytz always chosen

Bug #917223 reported by Geoff Flarity
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Graphite
Fix Released
Undecided
Unassigned

Bug Description

Near the top of /opt/graphite/webapp/graphite/render/glyph.py you see

try: # See if there is a system installation of pytz first
  import pytz
except ImportError: # Otherwise we fall back to Graphite's bundled version
  from graphite.thirdparty import pytz

However inside the default settings.py the thirdparty directory is inserted *before* other entries in sys.path:

sys.path.insert(0, THIRDPARTY_DIR)

Hence it will always use the third party one that is included with graphite (which is out of date and doesn't work on my system for some reason). This should be simple enough to fix by changing that insert to an append, but I'm not sure is there is some legitimate reason for the insert.

Also, if thirdparty is in the path anyways there's no need for the try/except around the pytz import.

I don't mind a patch for this, if my fix sounds good please let me know.

Revision history for this message
Michael Leinartas (mleinartas) wrote :

You're quite correct, the thirdparty dir doesnt need to be in sys.path at all since it's contained within the main webapp dir and the imports are relative to that path.

Revision history for this message
Michael Leinartas (mleinartas) wrote :

Fix committed in r704

Changed in graphite:
milestone: none → 0.9.10
status: New → Fix Committed
Revision history for this message
Michael Leinartas (mleinartas) wrote :

I partially undid this in r720 by adding the THIRDPARTY_DIR back to sys.path due to the pytz in thirdparty doing imports of its own components which expect itself to be in sys.path (example error: http://pastebin.com/rYC0NYm4). THIRDPARTY_DIR is now appended to the end of sys.path however, which should fix a local pytz never being used.

Changed in graphite:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.