[英]IIS, Python and reading files in a directory
i've setup IIS to run Python scripts using the instructions found here: http://support.microsoft.com/kb/276494 . 我已经设置IIS,以使用此处的说明运行Python脚本: http : //support.microsoft.com/kb/276494 。 I've confirmed that it works.
我已经确认可以使用。
I then tried this example using google charts along with a python script to return the data: http://www.jansipke.nl/using-google-visualization-api-with-own-data-source/ That too works fine as well. 然后,我尝试使用Google图表和python脚本返回该数据的示例: http : //www.jansipke.nl/using-google-visualization-api-with-own-data-source/效果也不错。
However, when i modify the python script to read a local file, i get a DataTable with no rows. 但是,当我修改python脚本以读取本地文件时,我得到了没有行的DataTable。 If i run the python script directly in the browser it prints a json object that looks like this:
如果我直接在浏览器中运行python脚本,它将打印一个看起来像这样的json对象:
google.visualization.Query.setResponse(
{
reqId:'0',
status:'ok',
table:
{
cols:
[
{id:'Date',label:'',type:'string'},
{id:'Price',label:'',type:'number'}
],
rows:
[
]
}
});
If however i run the script on the command line, it does print a json object with many rows. 但是,如果我在命令行上运行脚本,它会打印出包含许多行的json对象。 I suspect the issue is accessing local files from a script being run in the browser.
我怀疑问题出在浏览器中正在运行的脚本中访问本地文件。 I am not sure how to solve this however, esp in context of IIS.
我不确定如何解决这个问题,尤其是在IIS中。 Any help would be appreciated.
任何帮助,将不胜感激。
Edit: After some further investigation i found that the pythone.exe is receiving a ACCESS DENIED error when trying to access the path as user NT AUTHORITY\\IUSR. 编辑:经过进一步调查,我发现pythone.exe尝试以用户NT AUTHORITY \\ IUSR访问路径时收到ACCESS DENIED错误。 I can not add IUSR to the networked path.
我无法将IUSR添加到网络路径。 So i'm exploring if maybe i can run as myself, since i know i have read access to that networked directory.
因此,我正在研究是否可以自己运行,因为我知道我对该网络目录具有读取权限。
To solve this issue i did three things (not sure if all are required): 1. Create a new Application Pool and set Identiy to custom, using a login that has access to the networked paths. 为了解决此问题,我做了三件事(不确定是否全部必要):1.创建一个新的应用程序池,并使用有权访问网络路径的登录名将Identiy设置为custom。 2. For my virtual directories and applications, use the above application pool.
2.对于我的虚拟目录和应用程序,请使用上面的应用程序池。 3. In advanced settings for my virtual director and application, i set physical path credentials to a specific user that has access to the networked path.
3.在虚拟控制器和应用程序的高级设置中,我将物理路径凭据设置为有权访问网络路径的特定用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.