DynamoDS / Dynamo

Open Source Graphical Programming for Design
https://dynamobim.org
Other
1.68k stars 624 forks source link

Python (All Engines) - Dynamo3.2.2 - Python print function to DynamoConsole (stdout) error #15381

Open Cyril-Pop opened 2 weeks ago

Cyril-Pop commented 2 weeks ago

Dynamo Version

3.2.2.5494

Host

DynamoSandbox

Operating System

Microsoft Windows NT 10.0.19045.0

What did you do?

print variable in Python engine (to DynamoStdOut )

What did you expect to see?

Variables printed in Dynamo Console

What did you see instead?

Error

image

image

What packages or external references (if any) were used?

None

Stack Trace

Traceback CPython3/PythonNet

Node Name: Python Script Original Node Name: Python Script Package: Core.Scripting Dynamo Version: 3.2.2.5494 Host: Messages: InvalidOperationException : The calling thread cannot access this object because a different thread owns it. at System.Windows.Threading.Dispatcher.gThrowVerifyAccess|7_0() at Microsoft.Web.WebView2.Wpf.WebView2.get_CoreWebView2() at Dynamo.UI.Views.HomePage.DynamoViewModel_PropertyChanged(Object sender, PropertyChangedEventArgs e) at Dynamo.ViewModels.DynamoViewModel.Instance_PropertyChanged(Object sender, PropertyChangedEventArgs e) at Dynamo.Logging.DynamoLogger.Log(String message, LogLevel level, Boolean reportModification) at DSCPython.CPythonEvaluator.<>cDisplayClass20_0.b__0(String msg) at InvokeStub_Action1.Invoke(Object, Span1) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) [' File "", line 4, in \n', ' File "", line 10, in write\n'] State: Warning

Traceback IronPython2/3

Node Name: Python Script Original Node Name: Python Script Package: Core.Scripting Dynamo Version: 3.2.2.5494 Host: Messages: PythonEvaluator.Evaluate operation failed. Traceback (most recent call last): File "", line 4, in File "", line 9, in write SystemError: The calling thread cannot access this object because a different thread owns it. State: Warning

Details

CLR: 8.0.0

code to reproduce

import sys
import clr
import System
print('\n'.join(sys.path))

from System.Reflection import Assembly
dynamo = Assembly.Load('DynamoCore')
dynamo_version = dynamo.GetName().Version
print('dynamo_version', dynamo_version)
github-actions[bot] commented 2 weeks ago

Thank you for submitting the issue to us. We are sorry to see you get stuck with your workflow. While waiting for our team member to respond, please feel free to browse our forum at https://forum.dynamobim.com/ for more Dynamo related information.