简体   繁体   English

C#中的共享对象将在python脚本中使用

[英]shared object in C# to be used in python script

I have created a windows app which runs a python script. 我创建了一个运行python脚本的Windows应用程序。 I'm able to capture the output of the script in textbox. 我能够在文本框中捕获脚本的输出。 Now i need to pass a shared object to python script as an argument from my app. 现在我需要从我的应用程序将共享对象作为参数传递给python脚本。 what type of shared object should i create so that python script can accept it and run it or in simple words how do i create shared object which can be used by python script. 我应该创建什么类型的共享对象,以便python脚本可以接受并运行它,或者简单地说我如何创建可以由python脚本使用的共享对象。

thanks 谢谢

Since python is running as another process. 因为python作为另一个进程运行。 This is no way for python to access object in c# directly since process isolation. 由于进程隔离,python无法直接访问c#中的对象。

A way of marshal and un-marshal should be included to communicate between processes. 应该包括一种元帅和非元帅的方式来进行流程之间的沟通。

There are many way to communicate between processes. 进程之间有很多通信方式。 Share memory, file, TCP and so on. 共享内存,文件,TCP等。

5.4. 5.4。 Extending Embedded Python will help you to access the application object. 扩展嵌入式Python将帮助您访问应用程序对象。 In this case both application and python running in single process. 在这种情况下,应用程序和python都在单个进程中运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM