gpt4 book ai didi

c# - 没有名为 fcntl 的模块

转载 作者:行者123 更新时间:2023-11-30 21:15:46 25 4
gpt4 key购买 nike

我正在尝试使用 IronPython 2.7 在 .NET 4.0 上使用 IronPython 执行此方法。我正在使用 Windows 7

import os
import re
import nltk
import urllib
import xapian
import sys

def getData(url):
try:
html = urllib.urlopen(url)
text = html.read()
html.close()
except:
return "error"
try:
return nltk.clean_html(text) #takes the tokens
except:
return text

C#代码:

public static object Execute()
{
string scriptPath = "Calculator.py";
ScriptEngine engine = Python.CreateEngine();
engine.SetSearchPaths(new string[] { "c:\\Python26\\lib","c:\\Python26\\lib\\site-packages",
"C:\\IronPython-2.7\\Lib\\site-packages","C:\\IronPython-2.7\\Lib"});
ScriptSource source = engine.CreateScriptSourceFromFile(scriptPath);
ScriptScope scope = engine.CreateScope();
ObjectOperations op = engine.Operations;
source.Execute(scope);

dynamic Calculator = scope.GetVariable("Calculator");
dynamic calc = Calculator();

return calc.getData("http://www.wowebook.com/dot-net/ironpython-in-action.html");



}

有人能告诉我我做错了什么吗?我一直说我没有 fcntl 模块

最佳答案

fcntl isn't really Windows native (平台:Unix)所以你可能运气不好,the following StackOverflow thread可能(或可能不会)有帮助...

关于c# - 没有名为 fcntl 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5543229/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com