After installing pyCharm, when I type 'import os' the 'import" is red instead of blue and I get an error "unused import statement 'import os'" did I miss a step?
I don't think it's an error if you see "unused import statement" pyCharm IDE monitors unused variables, imports and other things to notify us that it might be a good idea to clean it up. Does python autocomplete work if you keep writing further? (os.path.join() e.g.)
I have added the path for the lib on multiple times and it adds them but then when i go back to the root file path it lost them so i am unable to access them. do you konw why this is? is there another way i can add them ? thank you for your time
Sorry to hear that! pyCharm 2024 seem to give a lot of people this kind of an error... I can't explain it or solve, but I heard multiple times that downgrading to pyCharm 2023 helps to solve it and it starts to work as expected! Maybe it's because pyCharm 2024 has removed python 2 support or something... Just guessing here
Yes, it's doesn't matter as much what python version we use, because code will be executed using pyRevit's or RevitPythonShells environment. We just need any python version and add Revit API stubs so we can code much quicker :)
1. Does your Autocomplete works in general in pyCharm? 2. Did you provide correct paths? Usually if it doesn't work it's one of these things that we need to check. If revit api autocomplete works but pyRevit not, then probably it's just a path issue
@@ErikFrits Sorry, I was referring to Autodesk Robot Structural Analysis API, the structural software from Autodesk. I'm able to have autocomplete when I'm using an ironpython node in Dynamo, but when I use pycharm (or vs code) with ironpython interpreter, the code runs normally, but the autocomplete doesn't work. I don't know where I'd find these stubs for a given software
Hi Erik, thanks for this free module! I had some issues setting up the dev environment but after hours of trial/error i got it to work. Here are some issues others might also encounter: 1. The python installer did NOT add the python path to the windows system environment variables so i had to add that manually. 2. I couldn't get the autocomplete stubs to work and was about to give up; the problem was that there where no "__init__.pyi" files in the Autodesk and Revit folders of your stubs package. When i added empty text files named "__init__.pyi" to these folders it finally worked.
👋 Hi Tommy, 1. Usually there is a tick box during python installation for that, maybe you missed it. 2. I am so sorry for this! I have uploaded the wrong folder for stubs. You are right, there should be __init__.py file in every folder so python can treat the whole thing as a package. I am going to replace folders in OneDrive asap. Thank you for letting me know about it!
@@ErikFrits You're welcome! I also have a question about the full course; if I buy it now can i start whenever i want? The reason I'm asking is I have no experience coding and want to learn some python basics before I start.
Hi Erik,i pasted the interpreter path like video. After clicking ok , my path disappeared immediately. even i cannot delete origin path.so i cannot type code about revit. Is any problem about settings? Thanks!
Hi, Sorry to hear that. Recently I head from someone that they had the same issue with the latest pyCharm. They have installed 2023 verison of pyCharm and it worked. I assume there is some weird bug in the newer version that fails to create interpreter for python 2.7, maybe it got too old for new pyCharm... So you can try installing older version of pyCharm, or you can also check out VS Code Revit API Autocomplete tutorial. It's another IDE, but it's also very popular and widely used. Hope this helps ;)
Hi Erik! As I told you yesterday, I can't get the autocomple stubs. The error that I got is "C:\Users\miacuaniello\AppData\Roaming\pyCharm Enviroments\RevitAPI 23\Scripts\python.exe" C:\Users\miacuaniello\Desktop\Mauro\PythonProject\Prova.py Traceback (most recent call last): File "C:\Users\miacuaniello\Desktop\Mauro\PythonProject\Prova.py", line 1, in from Autodesk.Revit.DB import * ImportError: No module named Autodesk.Revit.DB" Thank you
Hi, So based on the error I think you tried to run the script in pyCharm. We shouldn't do that. ✅ We use pyCharm or other code editors for writing python code better with Revit API Autocomplete. 👀 But Code will be executed by using pyRevit, RevitPythonShell or Python Node in Dynamo. 💡 our Revit API Scripts need a lot more libraries and connection to Revit Application to run, and we can't achieve that from a code editor. That's why we use plugins like pyRevit and RevitPythonShell ;) 📌 The goal for this video is to add Revit API Autocomplete. So if you get autosuggestions of Revit API classes, then you made it right! P.S. As someone has pointed out I have uploaded wrong folder as Revit API stubs. (they are missing __init__.pyi files) I am going to fix it very soon, and reupload them. Just be aware of that!
thank you erik, great explanation!
Happy to help!
After installing pyCharm, when I type 'import os' the 'import" is red instead of blue and I get an error "unused import statement 'import os'" did I miss a step?
I don't think it's an error if you see "unused import statement"
pyCharm IDE monitors unused variables, imports and other things to notify us that it might be a good idea to clean it up.
Does python autocomplete work if you keep writing further? (os.path.join() e.g.)
@@ErikFrits Yes the autocomplete seems to be working thanks.
I have added the path for the lib on multiple times and it adds them but then when i go back to the root file path it lost them so i am unable to access them. do you konw why this is?
is there another way i can add them ? thank you for your time
Аналогичная проблема - не получается добавить файл автозаполнения. Сбрасывает путь
Sorry to hear that!
pyCharm 2024 seem to give a lot of people this kind of an error...
I can't explain it or solve, but I heard multiple times that downgrading to pyCharm 2023 helps to solve it and it starts to work as expected!
Maybe it's because pyCharm 2024 has removed python 2 support or something... Just guessing here
@@ErikFrits спасибо, Эрик!
Вопрос решен! Перестановка IDE на более старую версию дало свои результаты ❤️🔥
@@evg_shamshin Супер! Рад слышать что проблема разрешилась 🥳
Happy Coding!
Hi.please share revit api stubs 2025❤
I will share them once pyRevit is supported in Revit 2025 😉
Wow. Thanks for the updated stubs
It was about time to do it 😅
Thanks for that, will the stubs work with python 3.x?
Yes, it's doesn't matter as much what python version we use, because code will be executed using pyRevit's or RevitPythonShells environment.
We just need any python version and add Revit API stubs so we can code much quicker :)
Ryrevit did not work with my as your in the video , I already added it but pycharm can not recognise it and didnot give me options like you
1. Does your Autocomplete works in general in pyCharm?
2. Did you provide correct paths?
Usually if it doesn't work it's one of these things that we need to check.
If revit api autocomplete works but pyRevit not, then probably it's just a path issue
Can I add this autocompletion for the Robot API?
I am not sure what is Robot API, but if it has its stubs or actual python package, then it will be possible.
@@ErikFrits Sorry, I was referring to Autodesk Robot Structural Analysis API, the structural software from Autodesk. I'm able to have autocomplete when I'm using an ironpython node in Dynamo, but when I use pycharm (or vs code) with ironpython interpreter, the code runs normally, but the autocomplete doesn't work. I don't know where I'd find these stubs for a given software
Hi Erik, thanks for this free module! I had some issues setting up the dev environment but after hours of trial/error i got it to work. Here are some issues others might also encounter:
1. The python installer did NOT add the python path to the windows system environment variables so i had to add that manually.
2. I couldn't get the autocomplete stubs to work and was about to give up; the problem was that there where no "__init__.pyi" files in the Autodesk and Revit folders of your stubs package. When i added empty text files named "__init__.pyi" to these folders it finally worked.
could you be more specific about the solution of autocomplete stubs?
Thanks
👋 Hi Tommy,
1. Usually there is a tick box during python installation for that, maybe you missed it.
2. I am so sorry for this! I have uploaded the wrong folder for stubs.
You are right, there should be __init__.py file in every folder so python can treat the whole thing as a package.
I am going to replace folders in OneDrive asap. Thank you for letting me know about it!
@@ErikFrits You're welcome! I also have a question about the full course; if I buy it now can i start whenever i want? The reason I'm asking is I have no experience coding and want to learn some python basics before I start.
Hi Erik,i pasted the interpreter path like video.
After clicking ok , my path disappeared immediately.
even i cannot delete origin path.so i cannot type code about revit.
Is any problem about settings?
Thanks!
Hi,
Sorry to hear that.
Recently I head from someone that they had the same issue with the latest pyCharm.
They have installed 2023 verison of pyCharm and it worked.
I assume there is some weird bug in the newer version that fails to create interpreter for python 2.7, maybe it got too old for new pyCharm...
So you can try installing older version of pyCharm, or you can also check out VS Code Revit API Autocomplete tutorial. It's another IDE, but it's also very popular and widely used.
Hope this helps ;)
@@ErikFrits Thanks a lot~ I've already reinstall 2023 version. It works!
Hi Erik!
As I told you yesterday, I can't get the autocomple stubs.
The error that I got is
"C:\Users\miacuaniello\AppData\Roaming\pyCharm Enviroments\RevitAPI 23\Scripts\python.exe" C:\Users\miacuaniello\Desktop\Mauro\PythonProject\Prova.py
Traceback (most recent call last):
File "C:\Users\miacuaniello\Desktop\Mauro\PythonProject\Prova.py", line 1, in
from Autodesk.Revit.DB import *
ImportError: No module named Autodesk.Revit.DB"
Thank you
Hi,
So based on the error I think you tried to run the script in pyCharm. We shouldn't do that.
✅ We use pyCharm or other code editors for writing python code better with Revit API Autocomplete.
👀 But Code will be executed by using pyRevit, RevitPythonShell or Python Node in Dynamo.
💡 our Revit API Scripts need a lot more libraries and connection to Revit Application to run, and we can't achieve that from a code editor. That's why we use plugins like pyRevit and RevitPythonShell ;)
📌 The goal for this video is to add Revit API Autocomplete. So if you get autosuggestions of Revit API classes, then you made it right!
P.S.
As someone has pointed out I have uploaded wrong folder as Revit API stubs. (they are missing __init__.pyi files)
I am going to fix it very soon, and reupload them. Just be aware of that!
THANK YOU!!@@ErikFrits