Python: Import "collections" module broken


#1

Hi All,

I just noticed that one can no longer import the standard collections module using Python in Rhino. I have only confirmed this using the latest Rhino Evaluation copy running on my private laptop. Perhaps it still works fine in the licensed version?

Best,

Anders


(Steve Baer) #2

I use namedtuple from the collections module in the ghpython.components module. There shouldn’t be any difference in what is available between the full version and the evaluation copy.

Maybe the path to the standard library that Rhino is supposed to use is not right. Do you see a collections.py file in
C:\Program Files\Rhinoceros 5.0 (64-bit)\Plug-ins\IronPython\Lib
?


#3

Thanks Steve,
I looked up the standard library path and it seems that the evaluation version does not contain the “correct” path. I added the one you suggest and all is again peachy:


(Steve Baer) #4

Thanks for letting me know. Looks like I need to tweak the code a little to do a better job of finding the standard library. What happens if you click the “Restore Defaults” button? Does that also fix things up?


#5

That fixes it. Looks like I had some settings lingering from the previous installation. Perhaps this has to do with the fact that I uninstalled the old version (due to this) and reinstalled the latest one in order to use the latest Grasshopper/GHPython component. Thanks again.


#6

I cannot get this working either. I have a new install of Rhino. It does not seem to work in GH or Rhino Python in 5 or WIP. Any ideas? I have ‘restored defaults’ as well as manually added Steve’s suggested path.

I had a lower case c:\ in my lib directory which I thought was strange, so I adjusted the path to no result. Thank you. The highlighted directory is the one I added, but have since deleted.