Reputation: 4877
Is it possible to make a python session aware of new libraries which have been easy_install
ed since the session was launched?
I have a console which has run for a few days, and finally came up with the (large) result. I realized upon inspecting the results that I would require another package (nltk
) for processing, which I installed, but the session can't import
it (new ones can). The problem is, I can't seem to save the unprocessed results (pickle
and marshal
give me errors about string lengths) and I really don't want to re-run the week-long procedure.
Upvotes: 3
Views: 479
Reputation: 36
You could try loading the new package using the imp module:
from imp import *
file, pathname, description = find_module('nltk')
nltk = load_module('nltk', file, pathname, ('.py', 'U', 1))
You may need to specify a path argument for find_module if python can't find the newly installed module:
file, pathname, description = find_module('nltk', '/path/to/nltk')
Replacing the last argument with the path that nltk was installed to.
Upvotes: 2