Python脚本调用Process.Start:32位进程无法访问64位进程的模块?

时间:2015-03-24 10:32:34

标签: c# python wpf

尝试运行一个Python脚本,该脚本从WPF应用程序中获取两个参数。我可以从cmd运行没问题:

enter image description here

这是我的Python安装:

C:\Python27\ArcGIS10.1\python.exe

然后我尝试从WPF调用脚本:

  private void CreateReportCommandAction()
    {
        try
        {
            string cmd = @"C:\temp\WebBuilder\webplus_builder.py";
            ProcessStartInfo start = new ProcessStartInfo();
            start.FileName = @"C:\Python27\ArcGIS10.1\python.exe";
            start.Arguments = string.Format("{0} {1} {2}", cmd, "WAF", _CountryCode);
            start.UseShellExecute = false;
            start.RedirectStandardOutput = true;
            Process process = Process.Start(start);
        }

我在Process对象主模块中遇到异常:

A 32 bit processes cannot access modules of a 64 bit process.

堆栈追踪:

     at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId, Boolean firstModuleOnly)
   at System.Diagnostics.NtProcessManager.GetFirstModuleInfo(Int32 processId)
   at System.Diagnostics.Process.get_MainModule()

应用程序设置为构建到任何CPU'。当我删除'首选32位'正如我从阅读中理解的那样,异常发生了变化,与相同的32-64位互操作性问题有关:

Only part of a ReadProcessMemory or WriteProcessMemory request was completed

是否有针对此的已知修复或解决方法?

0 个答案:

没有答案