python项目不由SSRS用户运行,但在myus上运行良好

2024-06-24 13:50:10 发布

您现在位置:Python中文网/ 问答频道 /正文

源代码#S已开发扩展S 它在我的报表设计器上起作用,但在服务器上却没有这样做。 错误发生在IDbConnection的open()实现中。 我的open用数据填充数据库表 然后创建一个批处理文件,该批处理文件运行一个python组件,该组件分析表并将结果放入另一个数据库表中。 填写表格的第一部分运行良好。 然后创建批。它正在运行,在python代码中的某个时候它崩溃了,我无法捕捉到任何异常(根本不是python专家,使用它是因为它是开源的,完全符合我的需要) 以下是在.NET端创建和运行批处理文件的方法:

static void mybatchexecution(int uniqueiteration)
{
    string batchfilename = @"C:\CoverageTemp\Coverage_" + uniqueiteration+".bat";
    StreamWriter sw = new StreamWriter(batchfilename);
    string batchcmd = @"F:\Python27\python.exe F:\CoverageProject\CoverageGrowth.py " + uniqueiteration;
    sw.WriteLine(batchcmd);
    sw.Close();
    try
    {
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.FileName = batchfilename;
        startInfo.RedirectStandardError = true;
        startInfo.RedirectStandardOutput = true;
        startInfo.LoadUserProfile = true;
        //this i already tried
        //startInfo.UserName = @"domain\user";
        //SecureString passWordObj = new SecureString();
        //foreach (Char C in "pass".ToCharArray())
        //    passWordObj.appendChar(C);
        //startInfo.Password = passWordObj;
        startInfo.CreateNoWindow = true;
        startInfo.UseShellExecute = false;
        Process childProcess = new Process();
        childProcess.StartInfo = startInfo;
        childProcess.Start();
        string t=childProcess.StandardOutput.ReadToEnd();
        childProcess.WaitForExit();
        string logfile=@"c:\trylogfile.txt";
        StreamWriter mylogwriter = new StreamWriter(logfile);
        mylogwriter.WriteLine(t);
        mylogwriter.WriteLine(childProcess.ExitCode);
        mylogwriter.Close();
    }
    catch (Exception e)
    {
        string logfilename = @"C:\catchlogfile.txt";
        StreamWriter logwriter = new StreamWriter(logfilename);
        logwriter.WriteLine(e.Message);
        logwriter.WriteLine(e.StackTrace);
        Exception et = e.InnerException;
        while (et != null)
        {
            logwriter.WriteLine(et.Message);
            logwriter.WriteLine(et.StackTrace);
            et = et.InnerException;
        }
        logwriter.Close();
    }
}

这是在python端运行的:

^{pr2}$

pythonequations是一个开源模块,使用numpy和scipy,并在mingwg++上编译。在

我总是在reportserver日志中看到错误:

An error occurred during client rendering.
An error has occurred during report processing. (rsProcessingAborted)
An internal error occurred on the report server. See the error log for more details.     (rsInternalError) 

和TRYLOGFILE.txt文件显示:

"
before init
before set initial parameters

1
"

python try except没有捕获到任何内容。 SSRS在具有管理员权限的用户下运行 最烦人的是,每次失败后我都可以自己运行批处理文件,而且它能正常工作 对于登录到服务器的其他开发人员也是如此。 值得一提的是,在每个新用户的第一次运行中,mingw正在编译python似乎要崩溃的地方。但在第一次运行之后,它从未显示此编译消息,mingw位于服务器上的c:\mingw中。在

感谢至今幸存下来的勇士们


Tags: 文件服务器truenewstringerroretstreamwriter