注册 | 登录

c# - Python Script call Process.Start: A 32 bit processes cannot access modules of a 64 bit process?

itPublisher 分享于



Trying to run a Python script which takes two parameters from a WPF application. I can run from cmd no problem:

This is my Python install:


I then try to invoke the script from WPF:

  private void CreateReportCommandAction()
            string cmd = @"C:\temp\WebBuilder\";
            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);

I am getting an exception in the Process object Main Module:

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

Stack Trace:

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

Application is set to build to 'any CPU'. When I remove 'Prefer 32 bit' the exception changes to this which as I understand from reading around is linked to the same 32-64 bit interoperability issue:

Only part of a ReadProcessMemory or WriteProcessMemory request was completed

Is there a known fix or workaround for this?

c# python wpf
  this question
edited Mar 24 '15 at 10:38 asked Mar 24 '15 at 10:32 Hardgraf 737 1 14 41      Are you using the 32 or 64 bit version of Python ? –  Jaco Mar 24 '15 at 10:53      32 bit 2.7 Python –  Hardgraf Mar 24 '15 at 11:06      Does it work if you set UseShellExecute=True ? You will have to temporarily comment out the redirection of the standard output to do this –  Jaco Mar 24 '15 at 11:47      'Process has exited, so the requested information is not available.' unfortuantely –  Hardgraf Mar 24 '15 at 11:52      Is that error thrown in the catch block ? –  Jaco Mar 24 '15 at 13:15


Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.








您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱