ITKeyword,专注技术干货聚合推荐

注册 | 登录

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

itPublisher 分享于

2020腾讯云双十一活动,全年最低!!!(领取3500元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1073

【阿里云】双十一活动,全年抄底价,限时3天!(老用户也有),
入口地址https://www.aliyun.com/1111/home

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:

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

I then try to invoke the script from 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);
        }

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.


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

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

如果您没有收到激活邮件,请注意检查垃圾箱。