【转载】C#调用python文件时出现'module' object has no attribute '_getframe'
来源:互联网 发布:淘宝主图视频制作教程 编辑:程序博客网 时间:2024/05/19 15:23
这几天这个问题困扰了我很久;
任务需要,环境是在VS13.NET中安装了ironpython,可以调用python代码;
在不引用python第三方模块的时候,C#中调用python(.py文件)经测试是正常的;
但是现在需要调用第三方模块,查了一下解决办法是在.py文件中
import sys
sys.path.append(……) 如图是将python的第三方模块全部添加到环境里了,然后问题来了;
python代码本身经测试也没有问题
在C#窗体中调用代码如下,提源代码
运行是会报错:'module' object has no attribute '_getframe'
查了下python的sys模块,有_getframe
查了下ironpython的sys模块,没有_getframe
也不是很清楚怎么解决,听说有个参数是:-X:Frames要run,如图红框
但是也没有弄成功;
也有听说在interupter options里面加参数,但是也没用,求解决啊!!!!!!!
var options = new Dictionary<string, object>();
options["Frames"] = true;
options["FullFrames"] = true;
ScriptRuntime pyRunTime = Python.CreateRuntime(options);
ScriptScope pyScope = pyRunTime.CreateScope();
dynamic obj = pyRunTime.UseFile("ceshi.py");
如果你不想用FullFrames,把它设成false也可以。
- 【转载】C#调用python文件时出现'module' object has no attribute '_getframe'
- python unittest 继承时出现 object has no attribute '_testMethodDoc'
- 使用sae-python-dev本地运行web.py项目出现module object has no attribute InteractiveInterpreter
- 'module' object has no attribute 在python开发中出现的原因
- python 中出现的AttributeError: 'module' object has no attribute '_handlerList'
- 关于python里运行出现'module' object has no attribute 'xxxx'等问题解决方法
- 出现错误如下:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
- [Python]attributeError:'module' object has no attribute 'dump'
- [python错误]builtins.AttributeError: 'module' object has no attribute 'request'
- python运行不了 AttributeError: module object has no attribute getdefaultlocale
- Python基础学习-'module' object has no attribute 'urlopen'解决方法
- python AttributeError: 'module' object has no attribute 'setdefaultencoding'
- python运行不了 AttributeError: module object has no attribute getdefaultlocale
- python AttributeError: 'module' object has no attribute 'dumps'解决办法
- Python AttributeError: 'module' object has no attribute xxxx
- 关于Python的:'module' object has no attribute 'inet_pton'问题解决
- Python 【精】AttributeError: 'Module' object has no attribute 'STARTF_USESHOWINDOW'
- Python AttributeError: ‘module’ object has no attribute ‘A’
- Java---线程
- 计算机网络系列(10)之应用场景Peer-to-peer systems
- 【PHP自学笔记】第十一章 图形图像处理
- MyBatis分页插件-PageHelper的配置与应用(二):即插即用的PageInfo<T>
- Sony Catalyst Production Suite 2017 官方版下载附安装教程
- 【转载】C#调用python文件时出现'module' object has no attribute '_getframe'
- CodeForces 144C Anagram Search(思维)
- linux系统之cifs文件的存储(samba)
- Java 笔记 之 开发工具 Eclipse 的安装
- 大数据(三十六)机器学习【相关概念】
- oracle数据库中几个大对象数据类型
- Hive字符函数
- 吴恩达深度学习笔记(四)week3目标检测
- 使用LaTeX基本数学公式