-
-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: app-init hook not working as intended (pyRevit 5) #2351
Comments
Just adding that this appears to be for any event handle that isn't command Id based. I've got it for doc-synced and doc-syncing also. If I manually address the line causing the error (version check), it proceeds on to have issues on line 83 regarding the engine attribute not being found. |
Thanks @aussieBIMguru for reporting this. We have introduced this bug by accessing the For a quick fix, we need to check the type of |
No worries, if something other than You've all done a brilliant job so far with pyRevit5, very few things have broken in my toolbar (aside from losing my Excel reader, but thats a netcore thing vs pyRevit, and my toast forms which I found a new option for), so great job! |
@aussieBIMguru @jmcouffin could you please try to replace those lines pyRevit/pyrevitlib/pyrevit/__init__.py Lines 58 to 61 in a5c6602
with the following and see if it solves the issue? def _get_revit_version():
if __revit__ is None:
raise Exception('Critical Error. __revit__ handle is not available.')
try:
# UIApplication
return __revit__.Application.VersionNumber
except AttributeError:
try:
# Application, (ControlledApplication)
return __revit__.VersionNumber
except AttributeError:
# UIControlledApplication
return __revit__.ControlledApplication.VersionNumber
# try get net folder
net_folder = "netcore" if int(_get_revit_version()) >= 2025 else "netfx" |
As a note, I believe that the first lines of |
Thanks @sanzoghenzo, although that appears to have caused downstream issues in the code I think (pyrevit doesn't load afterwards). I've disabled my hooks for now, but if any other ideas you wish to test in the code do let me know. |
I forgot an |
Great! That looks to have fixed the issue and allowed the hooks to work as intended in 2025. I also had to account for the same issue in I've tested the fix in versions 2021-2025, and ran a few tools to ensure it hasn't broadly jumbled the core functionality of pyRevit itself. I can see using an IDE that the version number is also being used in the Hope that helps lay down the pathway to the broader fix in the code. Thanks @sanzoghenzo. |
@sanzoghenzo Let me know if you take care of this or I need to do it. |
I'm at work handling a big emergency, so if you want a quick fix go ahead an do it 😉 |
No rush from my side on this, I've told my company we'll wait for the stable build before we roll anything out. Hope everything is OK @sanzoghenzo! |
draft PR #2363 |
@eirannejad can you explain why Also, could we break things in pyrevit5, totally get rid of the |
fixed by #2363 |
✈ Pre-Flight checks
🐞 Describe the bug
The app-init based hook appears to not work in pyRevit 5 WIP. Letting the team know so they can look into it when time allows.
⌨ Error/Debug Message
♻️ To Reproduce
Make a hook for app-init.py
When opening Revit app in 2025, message will show
⏲️ Expected behavior
app-init script runs as per lower builds
🖥️ Hardware and Software Setup (please complete the following information)
Additional context
I appreciate pyRevit 5 is WIP, just sharing for team to investigate when time suits - pyRevit still loads afterwards so it's not a major issue for now.
The text was updated successfully, but these errors were encountered: