Force python to use an older version of module (than what I have installed now)
If SingleNegationElimination's solution doesn't work, be aware that you don't need to replace all 33 instances of the import; you only need to modify sys.path
at the entry points; e.g. you could target just your module's __init__.py
files.
There you would insert e.g.
import sys
sys.path.insert(0, DIR)
A better version of option B. would be to replace
import twisted
by
import pkg_resources
pkg_resources.require("Twisted==8.2.0")
import twisted
which will arrange for the correct version of twisted to be imported, so long as it's installed, and raises an exception otherwise. This is a more portable solution.
This won't work, though (nor would any other variaton of option B), if twisted gets imported before the pkg_resources.require
gets called; twisted
will already be in sys.modules
OP Edit: Minor syntax correction, per pkg_resources
docs