我打电话,使用imaplib.py,并得到了没有名为模块的fcntl错误python脚本。从搜索,我发现这个模块仅在UNIX中可用,所以我不知道,如果PY脚本是混淆了什么操作系统是下运行。此外,脚本的工作原理下直接从Python目录运行窗口就好了。
I am calling a python script that uses imaplib.py and get the "no module named fcntl" error. From searching I found that this module is only available in unix and so I wonder if the py script is confused about what os it is running under. Again, script works fine under windows run directly from the python directory.
var engine = Python.CreateEngine();
ScriptScope scope = engine.CreateScope();
var ops = engine.Operations;
var script = engine.CreateScriptSourceFromFile("PyTest.py");
CompiledCode code = script.Compile();
//string scode = script.GetCode();
code.Execute(scope);
和最小的PY脚本来触发它。需要注意的是注释掉进口imaplib.py线将停止错误。
and the minimal py script to trigger it. Note that commenting out the import imaplib.py line will stop the error.
import sys
sys.path = ["PythonLib"]
sys.platform = ["win32"]
import os
import os
import getopt
import getpass
import time
import imaplib
我追查了一下,说imaplib.py用途subprocess.py,还有我注意到sys.platform变量,并试图将其设置Win32的上面一样,但并没有区别。东西是IronPython的调用环境的不同,在Windows命令从CPython的文件夹提示。
I traced it a bit to the subprocess.py that imaplib.py uses, there I noticed the sys.platform variable and tried setting it to win32 as above but made no difference. Something is different between the ironpython calling environment and the windows command prompt from the cpython folder.
推荐答案
首先你设置 sys.platform
到一个列表,它应该是一个字符串。 .NET / CLI是不同的平台的Win32的,所以只设置 sys.platform
也无济于事。
First of all you're setting sys.platform
to a list, it should be a string. .NET/CLI is a different platform than Win32 though, so just setting sys.platform
won't help.
一些谷歌搜索建议的IronPython不支持子
模块(或模块不支持IronPython的)。有一个部分替代的位置: http://www.ironpython.info/index.php?标题= The_subprocess_module
Some Googling suggests IronPython doesn't support the subprocess
module (or the module doesn't support IronPython). There is a partial replacement here: http://www.ironpython.info/index.php?title=The_subprocess_module
还有一些讨论,这里一个错误报告: http://bugs.python.org/issue8110
There's also a bugreport with some discussion here: http://bugs.python.org/issue8110
相关推荐
最新文章