Python Warning; No module named Autodesk.Revit ?!

revit
#1

Hello All,

After running the python code I got the following error. Why and how it could be solved?

File “< string >”, line 4, in < module >
ImportError: No module named Autodesk.Revit

line 4 is:
from Autodesk.Revit import *

Thanks.

0 Likes

#2
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
1 Like

#3

Tnanks @Einar_Raknes

How about this one?

TypeError: expected Document, got getset_descriptor

what causes TypeError? and how can I solve it?

0 Likes

#4

@Raha_R
could you post the whole code?

0 Likes

#5

@Raha_R You need to post here your work so that others can understand your problem. Read this how to get help on forum How to get help on the Dynamo forums

0 Likes

#6

You are feeding something a class instead of an object of that class.

0 Likes

#7

There is a code which just works with dynamo v.0.6. I am trying to update it to be usable in dynamo v.0.9.
What I am doing is; using different related syntax, but as I am not expert in python I am trying process of trial and error!
That would be great if someone could help me to write correct codes.

old code:

the new one (with errors):

0 Likes

#8

try adding this :

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager 

then change the way you access the document:

doc = DocumentManager.Instance.CurrentDBDocument

1 Like

#9

@Mostafa_El_Ayoubi Thanks!
It helped. I also have changed code a little bit to resolve the other errors and now it works perfectly.

0 Likes