尝试调用python的execfile函数时,Matlab崩溃了

时间:2018-02-19 18:05:53

标签: python python-2.7 matlab anaconda

我试图从内部调用一个简单的python脚本 Matlab和不幸的是Matlab崩溃了。我在Windows 10上。
我是通过致电py.execfile(filePathAndName)来做到这一点的 在Matlab的交互式命令窗口中。

我的Matlab目前指向Anaconda发行版,但它也是 如果我将它指向原始CPython发行版,则会以相同的方式崩溃。

非常感谢任何帮助。错误如下。

好奇的是,如果我只是打电话给 在Matlab中py.help('execfile')这很好用。

>> py.help('execfile')
Help on built-in function execfile in module __builtin__:

execfile(...)
    execfile(filename[, globals[, locals]])

    Read and execute a Python script from a file.
    The globals and locals are dictionaries, defaulting to the current
    globals and locals.  If only globals is given, locals defaults to it.

拨打py.execfile(filePathAndName)时出现错误:

    MATLAB crash file:C:\Users\Thunder\AppData\Local\Temp\matlab_crash_dump.1064-1:


    ------------------------------------------------------------------------
              Access violation detected at Mon Feb 19 20:02:39 2018
    ------------------------------------------------------------------------

    Configuration:
      Crash Decoding      : Disabled - No sandbox or build area path
      Crash Mode          : continue (default)
      Current Graphics Driver: Unknown software 
      Default Encoding    : windows-1252
      Deployed            : false
      Graphics card 1     : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics Version 9.17.10.4459 (2016-5-19)
      Host Name           : TimeMachine
      MATLAB Architecture : win64
      MATLAB Entitlement ID: 2781541
      MATLAB Root         : C:\Program Files\MATLAB\R2017b
      MATLAB Version      : 9.3.0.713579 (R2017b)
      OpenGL              : software
      Operating System    : Microsoft Windows 10 Education
      Processor ID        : x86 Family 6 Model 42 Stepping 7, GenuineIntel
      Virtual Machine     : Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
      Window System       : Version 10.0 (Build 16299)

    Fault Count: 1


    Abnormal termination:
    Access violation

    Register State (from fault):
      RAX = 00000000499221e0  RBX = 0000000000000000
      RCX = 0000000000000000  RDX = 00000000499221e0
      RSP = 00000000043fbb30  RBP = 0000000049397448
      RSI = 0000000000000000  RDI = 00000000499221e0

       R8 = fffffffffe7cc3e0   R9 = 000000004993a000
      R10 = 0000000049397448  R11 = 00000000043fb890
      R12 = 0000000046896ef0  R13 = 000000007d0023f4
      R14 = 00000000043fbe18  R15 = 000000009dc00110

      RIP = 0000000047f6354b  EFL = 00010206

       CS = 0033   FS = 0053   GS = 002b

    Stack Trace (from fault):
    [  0] 0x0000000047f6354b            C:\Users\Thunder\Anaconda2\python27.dll+00865611 PyDict_GetItem+00000011
    [  1] 0x0000000047fe6329            C:\Users\Thunder\Anaconda2\python27.dll+01401641 PyAST_FromNode+00034425
    [  2] 0x0000000047f8bd09            C:\Users\Thunder\Anaconda2\python27.dll+01031433 PyCFunction_Call+00000105
    [  3] 0x0000000047f44dd3            C:\Users\Thunder\Anaconda2\python27.dll+00740819 PyObject_Call+00000131
    [  4] 0x0000000047dc687f                                bin\win64\pycli.dll+00092287
    [  5] 0x0000000047dc28cb                                bin\win64\pycli.dll+00075979
    [  6] 0x0000000047decf6b                                bin\win64\pycli.dll+00249707
    [  7] 0x000000002d4c705d                        bin\win64\pgo\mcos_impl.dll+00553053
    [  8] 0x000000002d4c6848                        bin\win64\pgo\mcos_impl.dll+00550984
    [  9] 0x000000002d49524d                        bin\win64\pgo\mcos_impl.dll+00348749
    [ 10] 0x000000002d494b80                        bin\win64\pgo\mcos_impl.dll+00347008
    [ 11] 0x000000002d495de5                        bin\win64\pgo\mcos_impl.dll+00351717
    [ 12] 0x000000002d496f4e                        bin\win64\pgo\mcos_impl.dll+00356174
    [ 13] 0x0000000011e58f74                     bin\win64\pgo\m_dispatcher.dll+00036724 Mfh_MATLAB_fn::dispatch_fh+00000660
    [ 14] 0x000000002d493ab0                        bin\win64\pgo\mcos_impl.dll+00342704
    [ 15] 0x0000000011e5a8d8                     bin\win64\pgo\m_dispatcher.dll+00043224 Mfunction_handle::dispatch+00001032
    [ 16] 0x000000001427794e                            bin\win64\pgo\m_lxe.dll+00227662
    [ 17] 0x0000000014273747                            bin\win64\pgo\m_lxe.dll+00210759
    [ 18] 0x000000001427348a                            bin\win64\pgo\m_lxe.dll+00210058
    [ 19] 0x000000001427339b                            bin\win64\pgo\m_lxe.dll+00209819
    [ 20] 0x00000000142732fa                            bin\win64\pgo\m_lxe.dll+00209658
    [ 21] 0x000000001427b3a6                            bin\win64\pgo\m_lxe.dll+00242598
    [ 22] 0x000000001427bfb3                            bin\win64\pgo\m_lxe.dll+00245683
    [ 23] 0x000000001427dff5                            bin\win64\pgo\m_lxe.dll+00253941
    [ 24] 0x000000001427d44f                            bin\win64\pgo\m_lxe.dll+00250959
    [ 25] 0x000000001427d822                            bin\win64\pgo\m_lxe.dll+00251938
    [ 26] 0x000000001434331b                            bin\win64\pgo\m_lxe.dll+01061659 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00604503
    [ 27] 0x000000001434ad46                            bin\win64\pgo\m_lxe.dll+01092934 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00635778
    [ 28] 0x000000001434a570                            bin\win64\pgo\m_lxe.dll+01090928 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00633772
    [ 29] 0x00000000142da4d6                            bin\win64\pgo\m_lxe.dll+00632022 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00174866
    [ 30] 0x00000000142d9ccd                            bin\win64\pgo\m_lxe.dll+00629965 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00172809
    [ 31] 0x00000000142d9be6                            bin\win64\pgo\m_lxe.dll+00629734 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00172578
    [ 32] 0x00000000142d35a5                            bin\win64\pgo\m_lxe.dll+00603557 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00146401
    [ 33] 0x00000000142d3532                            bin\win64\pgo\m_lxe.dll+00603442 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00146286
    [ 34] 0x00000000142d71d5                            bin\win64\pgo\m_lxe.dll+00618965 boost::serialization::singleton<boost::archive::detail::pointer_oserializer<boost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree> >::get_instance+00161809
    [ 35] 0x0000000013795b63                    bin\win64\pgo\m_interpreter.dll+00416611 inEvalCmdWithLocalReturn+00000063
    [ 36] 0x00000000fb60de26                          bin\win64\libmwbridge.dll+00122406 mnParser+00001254
    [ 37] 0x0000000011d3bdb1                                  bin\win64\mcr.dll+00245169 mcr::runtime::setInterpreterThreadSingletonToCurrent+00029793
    [ 38] 0x0000000011d3ace5                                  bin\win64\mcr.dll+00240869 mcr::runtime::setInterpreterThreadSingletonToCurrent+00025493
    [ 39] 0x0000000011d3ad53                                  bin\win64\mcr.dll+00240979 mcr::runtime::setInterpreterThreadSingletonToCurrent+00025603
    [ 40] 0x0000000011d3b6e1                                  bin\win64\mcr.dll+00243425 mcr::runtime::setInterpreterThreadSingletonToCurrent+00028049
    [ 41] 0x00000000fd02cc77                                  bin\win64\iqm.dll+00642167 iqm::UserEvalPlugin::pre+00028951
    [ 42] 0x00000000fd039cfc                                  bin\win64\iqm.dll+00695548 iqm::UserEvalPlugin::pre+00082332
    [ 43] 0x00000000fd02737f                                  bin\win64\iqm.dll+00619391 iqm::UserEvalPlugin::pre+00006175
    [ 44] 0x00000000fd02cc16                                  bin\win64\iqm.dll+00642070 iqm::UserEvalPlugin::pre+00028854
    [ 45] 0x00000000fd027863                                  bin\win64\iqm.dll+00620643 iqm::UserEvalPlugin::pre+00007427
    [ 46] 0x00000000fd03c8b6                                  bin\win64\iqm.dll+00706742 iqm::UserEvalPlugin::pre+00093526
    [ 47] 0x00000000fd0080f7                                  bin\win64\iqm.dll+00491767 iqm::PackagedTaskPlugin::PackagedTaskPlugin+00000759
    [ 48] 0x00000000fd0088bf                                  bin\win64\iqm.dll+00493759 iqm::PackagedTaskPlugin::execute+00000879
    [ 49] 0x00000000fd00817d                                  bin\win64\iqm.dll+00491901 iqm::PackagedTaskPlugin::PackagedTaskPlugin+00000893
    [ 50] 0x00000000fd008708                                  bin\win64\iqm.dll+00493320 iqm::PackagedTaskPlugin::execute+00000440
    [ 51] 0x00000000fcfdbd3a                                  bin\win64\iqm.dll+00310586 iqm::Iqm::setupIqmFcnPtrs+00079802
    [ 52] 0x00000000fcfdbc06                                  bin\win64\iqm.dll+00310278 iqm::Iqm::setupIqmFcnPtrs+00079494
    [ 53] 0x00000000fcfbf5be                                  bin\win64\iqm.dll+00193982 iqm::Iqm::deliver+00004046
    [ 54] 0x00000000fcfc0545                                  bin\win64\iqm.dll+00197957 iqm::Iqm::deliver+00008021
    [ 55] 0x00000001001237c1                        bin\win64\libmwservices.dll+01259457 services::system_events::PpeDispatchHook::dispatchOne+00021505
    [ 56] 0x0000000100128663                        bin\win64\libmwservices.dll+01279587 sysq::addProcessPendingEventsUnitTestHook+00002211
    [ 57] 0x0000000100128850                        bin\win64\libmwservices.dll+01280080 sysq::addProcessPendingEventsUnitTestHook+00002704
    [ 58] 0x0000000100129c26                        bin\win64\libmwservices.dll+01285158 sysq::getCondition+00003462
    [ 59] 0x000000010012ac66                        bin\win64\libmwservices.dll+01289318 svWS_ProcessPendingEvents+00000230
    [ 60] 0x0000000011d3c244                                  bin\win64\mcr.dll+00246340 mcr::runtime::setInterpreterThreadSingletonToCurrent+00030964
    [ 61] 0x0000000011d3c964                                  bin\win64\mcr.dll+00248164 mcr::runtime::setInterpreterThreadSingletonToCurrent+00032788
    [ 62] 0x0000000011d32762                                  bin\win64\mcr.dll+00206690 mcr_process_events+00008818
    [ 63] 0x0000000011c723c5                             bin\win64\MVMLocal.dll+00271301 mvm_server::inproc::LocalFactory::terminate+00088005
    [ 64] 0x00000000fa957669                                  bin\win64\mvm.dll+01209961 mvm::detail::initLocalMvmHack+00000569
    [ 65] 0x00000000fa957e2b                                  bin\win64\mvm.dll+01211947 mvm::detail::SessionImpl::privateSession+00000555
    [ 66] 0x00000000fa958051                                  bin\win64\mvm.dll+01212497 mvm::detail::SessionImpl::privateSession+00001105
    [ 67] 0x0000000140007833                               bin\win64\MATLAB.exe+00030771
    [ 68] 0x000000014000863f                               bin\win64\MATLAB.exe+00034367
    [ 69] 0x00007ff998ed1fe4                   C:\WINDOWS\System32\KERNEL32.DLL+00073700 BaseThreadInitThunk+00000020
    [ 70] 0x00007ff99b9defc1                      C:\WINDOWS\SYSTEM32\ntdll.dll+00454593 RtlUserThreadStart+00000033


    If this problem is reproducible, please submit a Service Request via:
        http://www.mathworks.com/support/contact_us/

    A technical support engineer might contact you with further information.

    Thank you for your help.

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。解决方案是提供工作空间参数。正如py.eval:Call Python eval Function所描述的那样。例如,您可以尝试:

&longitude

这应该运行没有错误或崩溃MATLAB。

相关问题