Python standard libs not importing

I’ve added a Python script node, but inside I was going to use the defaultdictionary. So I needed to import collections:

from collections import defaultdict

However, this produced an error: ImportError: No module named collections

The only way I could get it to import properly was to manually append the path to the Python libs into sys. E.g.

sys.path.append(r<span style=“color: #808080;”>‘C:\Program Files\Autodesk\Composite2014\python\lib’</span>)

I’m using it under Revit 2014, but also have IronPython under SharpDevelop. And it seems there’s an IronPython 2.7 installed under the x86 program folder. Then I’ve also for the Interactive Python Shell addon installed for Revit. And as you can see the python libs are then in some of the Adesk program folders (though I’m not sure I should refer to these for imports).

Is there something wrong with my installation or is this just how it’s supposed to be done?

1 Like