Open baaswietse opened 1 year ago
@baaswietse Tried it on my side with latest installers and engine 2711
from pyrevit import revit, script, HOST_APP
script.store_data("example", "Hello World!", this_project=True)
with revit.Transaction("test"):
pass
print(script.data_exists("example"))
print(script.load_data("example"))
print(HOST_APP.doc.PathName)
It works just fine
This issue is stale because it has been open for 60 days with no activity.
Sorry for my silence @jmcouffin , I forgot you asked for my help on this 😅
I also couldn't reproduce on my Windows 10 installation, revit 2022 (I need to ask my IT to install newer version!), both local and cloud models.
Could it be a Windows 11 related problem?
@baaswietse does the issue still occur on the latest pyRevit version? And is that a problem with a specific revit version (I see that you have installed 4 versions, but never mentioned which one you are using and/or if some version beahve differently)?
I tend to think it was a false positive. File not saved or something. No reply from @baaswietse ...
I installed the latest PyRevit and this issue still persists. The Revit version does not matter, as I tried it with all of them. I think this might be related to engine 277.
Could you please test if you have this issue using engine 277? I have some issues switching to 2711.
@baaswietse Changing the Iron Python engine from 277 to 2711 should not bring you more errors. There are no fundamental changes between the two, or none that I know of. I just tried it with 277, works like a charm.
Thank you for trying. I switched to 2711 and ran your script (RVT2024).
# -*- coding: utf-8 -*-
__title__ = "Test"
__doc__ = "Test"
from pyrevit import revit, script, HOST_APP
script.store_data("example", "Hello World!", this_project=True)
with revit.Transaction("test"):
pass
print(script.data_exists("example"))
print(script.load_data("example"))
print(HOST_APP.doc.PathName)
But still this error pops up
IronPython Traceback:
Traceback (most recent call last):
File "C:\Users\Wietse_d\Documents\Github\WDE-addins\WYC-addins.extension\WYC.tab\Dev.panel\Test.pushbutton\script.py", line 9, in <module>
File "C:\Users\Wietse_d\AppData\Roaming\pyRevit\pyRevit\master\pyrevitlib\pyrevit\script.py", line 777, in data_exists
File "C:\Users\Wietse_d\AppData\Roaming\pyRevit\pyRevit\master\pyrevitlib\pyrevit\script.py", line 340, in get_document_data_file
File "C:\Users\Wietse_d\AppData\Roaming\pyRevit\pyRevit\master\pyrevitlib\pyrevit\revit\db\__init__.py", line 303, in filename
File "C:\Users\Wietse_d\AppData\Roaming\pyRevit\pyRevit\master\pyrevitlib\pyrevit\revit\db\__init__.py", line 299, in path
AttributeError: 'NoneType' object has no attribute 'PathName'
Script Executor Traceback:
System.MissingMemberException: 'NoneType' object has no attribute 'PathName'
at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at IronPython.Runtime.Binding.PythonGetMemberBinder.FastPropertyGet`1.GetProperty(CallSite site, TSelfType target, CodeContext context)
at IronPython.Compiler.Ast.DynamicGetMemberExpression.GetMemberInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Runtime.PythonProperty.__get__(CodeContext context, Object instance, Object owner)
at IronPython.Runtime.PythonProperty.TryGetValue(CodeContext context, Object instance, PythonType owner, Object& value)
at IronPython.Runtime.Types.GetMemberDelegates.SlotOnly(CallSite site, Object self, CodeContext context)
at IronPython.Compiler.Ast.DynamicGetMemberExpression.GetMemberInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Runtime.PythonProperty.__get__(CodeContext context, Object instance, Object owner)
at IronPython.Runtime.PythonProperty.TryGetValue(CodeContext context, Object instance, PythonType owner, Object& value)
at IronPython.Runtime.Types.GetMemberDelegates.SlotOnly(CallSite site, Object self, CodeContext context)
at IronPython.Compiler.Ast.DynamicGetMemberExpression.GetMemberInstruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at Microsoft.Scripting.Interpreter.FuncCallInstruction`6.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run6[T0,T1,T2,T3,T4,T5,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
at Microsoft.Scripting.Interpreter.DynamicInstruction`6.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)
Can you provide a screenshot of the output window and Revit? @baaswietse what kind of file is it? local, on server, BIM360, not saved file?
Here you go. I tried on a local saved model and cloud model (ACC). Same result.
ok, I will check it more in depth in the coming days.
Describe the bug ProjectInfo class loses reference to the currently opened document after a transaction is closed. This bug was discovered after running the functions script.data_exitst(“example”), script.store_data(“example”, dataClass) or script.load_data(“example”) after a transaction.
To Reproduce Running this snippet reproduces the error
Error:
Desktop:
Additional context More information can be found in the issue I created on the pyrevit forum