Hi everyone, I’m new to this community!
I am an architect and currently working as a Revit specialist, and I am diving into dynamo and python scripting. I’m trying to set up vscode with intellisense to help me write scripts. I have found some guides on how to do it, but nothing works for me. I am working with VSCode 1.75 and Revit 2022.
Below I put what I am doing and the problems I am having.
-In the python script window there are two options (CPython3 and IronPython2) I have checked the IronPython2 option.
-I have downloaded the Talarico Gui repository.
-When I try to configure my options in the Json file some options like:
appear as unknown.
-The python version I get in the VSCode terminal is 2.7.18, but the interpreter shows 3.10.
-VSCode does not recognize other interpreters, and when I try to specify path I get this error:
“The isort server crashed 5 times in the last 3 minutes. The server will not be restarted.”
Anyway, a lot of things that exceed my computer knowledge, so if anyone has gone through the same thing or can help me I will be forever grateful.
Thanks for reading me!
Well - to start…
- Dynamo has its own install of python. In 2022 - two versions.
- VSCode will have its install of python. maybe several.
pyRevit ships with 6 IronPython versions and 2 CPython versions.
The first step is to either make sure they are all set to their own version number you want to use. Or set the python paths and environment variables to the same location. I do the first, since I’m deploying to workstations each with their own default installation locations and no VSCode. The second gets into deployment issues. Bother.
As for the intellisense - I haven’t bothered setting that all up. I just type - Use the Force.
Thank you very much for replying!
I don’t know how pyRevit works, I will download it and take a look to see how it works. The workflow I was following was to open pythonScript nodes in Dynamo, and paste the code I had written in VSCode, but maybe it’s not the best way…
Personally, I think if you are writing Dynamo, stick with nodes as much as possible and use python sparingly. And for that, the dynamo editor is adequate.
If you are getting into a lot of python - just jump to pyRevit. You set up a bundle and then to test you can just hit the Revit icon you made. You can code in VSCode and just save to update. There is no reload or anything to do. One big advantage of pyRevit is deployment and maintenance. Just a file structure and some code files. Move them around as needed and the changes will be reflected in users sytems each time they start Revit.
pyRevit will run Python scripts, Visual Basic scripts, C .Net scripts, and Dynamo scripts. So it gives you a consistent interface and deployment process for all of your work.
You’ll also want to install Python Shell. It is great for testing little snippets of code.