Pyrevit: Dynamo Conflict?

Created on 23 Aug 2017  路  21Comments  路  Source: eirannejad/pyRevit

Running into this error running most current pyRevit package while running Dynamo. I have to disable pyRevit during Dynamo editing. Thought it be worth sharing here. From clicking a codeblock in an empty environment:

Method not found: 'Void ICSharpCode.AvalonEdit.Editing.TextArea.ClearSelection()'.

at Dynamo.UI.Controls.CodeCompletionEditor.OnTextAreaLostFocus(Object sender, RoutedEventArgs e)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.IsFocused_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at ICSharpCode.AvalonEdit.Editing.TextArea.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
at System.Windows.DependencyObject.ClearValue(DependencyPropertyKey key)
at System.Windows.Input.FocusManager.OnFocusedElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.Input.FocusManager.SetFocusedElement(DependencyObject element, IInputElement value)
at System.Windows.Input.KeyboardNavigation.UpdateFocusedElement(DependencyObject focusTarget)
at System.Windows.FrameworkElement.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)
at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
at System.Windows.UIElement.Focus()
at Dynamo.Controls.DynamoView.OnRequestReturnFocusToView()
at Dynamo.ViewModels.DynamoViewModel.OnRequestReturnFocusToView()
at Dynamo.ViewModels.DynamoViewModel.ExecuteCommand(RecordableCommand command)
at Dynamo.ViewModels.WorkspaceViewModel.StateMachine.InitiateWindowSelectionSequence()
at Dynamo.ViewModels.WorkspaceViewModel.StateMachine.HandleLeftButtonDown(Object sender, MouseButtonEventArgs e)
at Dynamo.Views.WorkspaceView.OnMouseLeftButtonDown(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Most helpful comment

Guys,

  • Uninstall pyRevit and Dynamo (all versions)
  • Uninstall all IronPython installations
  • Install pyRevit
  • Install Dynamo 1.3

Run Revit. This is working fine on my PC. The issue for me was that IronPython 2.7.7 assemblies where in the GAC. Now thy coexist in Revit loaded from different locations.

ipy2

Let me know if this works for you

All 21 comments

Thank you for the insight. Much appreciated. Apologies for posting again.

No worries pal. Thanks for the input and sorry for the trouble.

We get all sorts of errors from Dynamo due to the difference between IronPython engines. Dynamo is using a much older version and this is really a Dynamo issue. On my machine, I can't even use dynamo without the pyRevit even since the Ironpython 2.7.7 is installed in GAC.

Best solution is for Dynamo to be specific about the module version it wants to use or upgrade to 2.7.7

Guys,

  • Uninstall pyRevit and Dynamo (all versions)
  • Uninstall all IronPython installations
  • Install pyRevit
  • Install Dynamo 1.3

Run Revit. This is working fine on my PC. The issue for me was that IronPython 2.7.7 assemblies where in the GAC. Now thy coexist in Revit loaded from different locations.

ipy2

Let me know if this works for you

Thank you, makes sense. I will try this tonight and report back any conflicts or successes. Much appreciated!

No conflicts, all successes. Thanks again for your time and insight!

I've uninstalled both pyRevit, Ironpython and Dynamo and Reinstalled Dynamo's new version and it continues to have a gray code box.

Uninstall your python packages too.

Everything is gone. Still, has my code block grayed out.

The odd part is that my 2016 Revit works, but my 2017 isn't working.

I've uninstalled all my add-in and noticed that we have an in-house add-in which I have submitted a bug to our bitbucket. Thank you for your help.

@dannysbentley So has the issue been resolved?

For me it works great! thanks a lot.

This solved it for me as well

@eirannejad Can you expand on this for us average people :)?
_The issue for me was that IronPython 2.7.7 assemblies where in the GAC_
I took a look at this but I don't fully understand the what causes the conflict.
Do they have to be reinstalled in a particular order?

GAC is the Global Assembly Cache. It's the place where the dlls for .net frameworks are placed. When a program references a dll, the resolver eventually looks into this folder to find the referenced dll.

When IronPython is installed, it naturally installs its dlls in this folder for all programs to be able to reference and use. The problem is that Revit and pyRevit are both shipped with the IronPython dlls and the fallback on the GAC dlls is not a desired outcome due to different versions. Also Dynamo installs an older version of IronPython (that placed its dlls in the GAC). And not being able to install multiple versions of IronPython is not helping this either.

So we need to uninstall Dynamo, Uninstall all IronPython installations to get rid of the dlls in the GAC. Then install pyRevit and Dynamo again. Installing Dynamo last, helps for ensure the environment is set for Dynamo execution.

Does this actually have to do with IronPython version - the stack trace is a missing method exception in Avalon edit- which I see you also ship with the addin: https://github.com/eirannejad/pyRevit/blob/master/pyrevitlib/pyrevit/loader/addin/ICSharpCode.AvalonEdit.dll

Revit ships it's own version and Dynamo another most likely.

pyRevit is not using AvalonEdit. It's a leftover dll from RPS. I'm removing it for next version just in case.

The exception that I'm getting in Dynamo is not AvalonEdit-related at all. It's an exception on GetEngine() method of IronPython module.

can you share the stackTrace that you get?

Method not found: 'Microsoft.Scripting.Hosting.ScriptEngine IronPython.Hosting.Python.CreateEngine()'.

   at Dynamo.Python.IronPythonCompletionProvider..ctor()
   at PythonNodeModelsWpf.ScriptEditorWindow..ctor(DynamoViewModel dynamoViewModel)
   at PythonNodeModelsWpf.PythonNodeViewCustomization.EditScriptContent()
   at PythonNodeModelsWpf.PythonNodeViewCustomization.view_MouseDown(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

@jnealb 鈽濓笍 FYI

mjkkirschner you have a broken link in your post

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheBIMsider picture TheBIMsider  路  5Comments

jkcameron picture jkcameron  路  5Comments

Robbo1234 picture Robbo1234  路  4Comments

Arsany123 picture Arsany123  路  4Comments

pihglez picture pihglez  路  4Comments