Could not load file or assembly 'RevitAPI' Error in Vscode using Python

naveen_t49E3J
Explorer
Explorer

Could not load file or assembly 'RevitAPI' Error in Vscode using Python

naveen_t49E3J
Explorer
Explorer

Hi Everyone,

I am trying to build my first Revit plugin in Vs code using python but unable to import any Autodesk Packages, I am facing the below error can anyone please help me in resolving these issues. I have followed this link for installing the required Tools 'https://www.youtube.com/watch?v=88zIQCZw8BA' Thanks in Advance.
**CODE IS:-**
**import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
print('success')**
Exception has occurred: FileNotFoundException
Could not load file or assembly 'RevitAPI' or one of its dependencies. The system cannot find the file specified.
File name: 'RevitAPI'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Python.Runtime.AssemblyManager.LoadAssembly(AssemblyName name)
at Python.Runtime.CLRModule.AddReference(String name)
**Please Note that I have successfully installed the Autodesk packages using command in vscode terminal:**
**pip install clr
pip install Autodesk
pip install Revit**

[enter image description here](https://i.stack.imgur.com/Glln4.png)

Reply
388 Views
1 Reply
Reply (1)

moturi.magati.george
Autodesk
Autodesk

Hi @naveen_t49E3J,

 

You could try a solution that was suggested on this forum before.

 

https://forums.autodesk.com/t5/revit-api-forum/how-to-load-our-own-dll-written-with-the-revit-api-in...

 

 

  Moturi George,     Developer Advocacy and Support,  ADN Open