Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1 REPLY 1
Reply
Message 1 of 2
naveen_t49E3J
255 Views, 1 Reply

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

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)

Visual Studio Code Intellisense for Revit. How to edit the settings so to better fit the needs of a developer who use #RevitAPI and #pyrevit Refer to the following link for the comprehensive article: https://www.macro4bim.com/post/vscode-intellisense-for-revit
Labels (5)
1 REPLY 1
Message 2 of 2

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community