Python Warning; No module named Autodesk.Revit ?!

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.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
2 Likes

Tnanks @Einar_Raknes

How about this one?

TypeError: expected Document, got getset_descriptor

what causes TypeError? and how can I solve it?

@Raha_R
could you post the whole code?

@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

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

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):

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

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