Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Python external libraries import error

$
0
0

Hello,

I am trying to use IfcOpenShell library inside grasshopper (Python component). I have developed a script in the VS Code (python version 3.12.4) which works correctly. Now, I am trying to convert that script to Grasshopper environment and use it with geometry.

I have problem right at the beginning with the external library import. I managed to install library and run simple script using following code:

# r: ifcopenshell

import ifcopenshell as ifc 

print(ifc)

However, my script requires to use “sub libraries”

import ifcopenshell.api.root
import ifcopenshell.api.unit
import ifcopenshell.api.context
import ifcopenshell.api.project
import ifcopenshell.api.geometry
import ifcopenshell.api.aggregate

If I run following code inside grasshopper python component, import of “sub libraries” raises an error:

TypeError: dataclass() got an unexpected keyword argument 'slots'

Searching the error, it seems it can be related to the python version. Rhino uses python 3.9.10. I have found similar problem with solution here, downloaded IfcOpenShell for pyython 3.9 form builds.ifcopenshell.org and copied it into .rhinocode/py39-rh8 directory. But without success.

Are there any solutions?

Thank you

Best

Ondřej

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles