• <legend id='r42wM'><style id='r42wM'><dir id='r42wM'><q id='r42wM'></q></dir></style></legend>
    <i id='r42wM'><tr id='r42wM'><dt id='r42wM'><q id='r42wM'><span id='r42wM'><b id='r42wM'><form id='r42wM'><ins id='r42wM'></ins><ul id='r42wM'></ul><sub id='r42wM'></sub></form><legend id='r42wM'></legend><bdo id='r42wM'><pre id='r42wM'><center id='r42wM'></center></pre></bdo></b><th id='r42wM'></th></span></q></dt></tr></i><div id='r42wM'><tfoot id='r42wM'></tfoot><dl id='r42wM'><fieldset id='r42wM'></fieldset></dl></div>
    • <bdo id='r42wM'></bdo><ul id='r42wM'></ul>
    <tfoot id='r42wM'></tfoot>

    1. <small id='r42wM'></small><noframes id='r42wM'>

        酸洗错误:不能酸洗&lt;type 'function'&

        时间:2023-08-06

        <small id='9TMtW'></small><noframes id='9TMtW'>

          <tbody id='9TMtW'></tbody>
        <tfoot id='9TMtW'></tfoot>
        • <bdo id='9TMtW'></bdo><ul id='9TMtW'></ul>
              <i id='9TMtW'><tr id='9TMtW'><dt id='9TMtW'><q id='9TMtW'><span id='9TMtW'><b id='9TMtW'><form id='9TMtW'><ins id='9TMtW'></ins><ul id='9TMtW'></ul><sub id='9TMtW'></sub></form><legend id='9TMtW'></legend><bdo id='9TMtW'><pre id='9TMtW'><center id='9TMtW'></center></pre></bdo></b><th id='9TMtW'></th></span></q></dt></tr></i><div id='9TMtW'><tfoot id='9TMtW'></tfoot><dl id='9TMtW'><fieldset id='9TMtW'></fieldset></dl></div>
              <legend id='9TMtW'><style id='9TMtW'><dir id='9TMtW'><q id='9TMtW'></q></dir></style></legend>

                  本文介绍了酸洗错误:不能酸洗&lt;type 'function'&gt;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想知道这个错误可能意味着什么:

                  I am wondering what this error might mean:

                  PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed
                  

                  我知道这与使用多核有关.我在集群上运行我的程序,并在我的这行代码中使用了 15 个线程:

                  I understand that it has something to do with using multiple cores. I am running my program on a cluster and using 15 threads in this line of my code:

                  gauss2 = PTSampler(ntemps, renwalkers, rendim, lnlike, lnprior, threads=15)
                  

                  有问题的采样器是在 http:///dan.iel.fm/emcee/current/user/pt/

                  知道这个错误可能意味着什么吗?

                  Any idea what this error might mean?

                  推荐答案

                  这个错误意味着你试图腌制一个内置的 FunctionType……而不是函数本身.这可能是由于某个地方的编码错误导致了函数的类而不是函数本身.

                  The error means you are trying to pickle a builtin FunctionType… not the function itself. It's likely do to a coding error somewhere picking up the class of the function instead of the function itself.

                  >>> import sys
                  >>> import pickle
                  >>> import types
                  >>> types.FunctionType
                  <type 'function'>
                  >>> try:
                  ...     pickle.dumps(types.FunctionType)
                  ... except:
                  ...     print sys.exc_info()[1]
                  ... 
                  Can't pickle <type 'function'>: it's not found as __builtin__.function
                  >>> def foo(x):
                  ...   return x
                  ... 
                  >>> try:
                  ...     pickle.dumps(type(foo))
                  ... except:
                  ...     print sys.exc_info()[1]
                  ... 
                  Can't pickle <type 'function'>: it's not found as __builtin__.function
                  >>> try:
                  ...     pickle.dumps(foo.__class__)
                  ... except:
                  ...     print sys.exc_info()[1]
                  ... 
                  Can't pickle <type 'function'>: it's not found as __builtin__.function
                  >>> pickle.dumps(foo)
                  'c__main__
                  foo
                  p0
                  .'
                  >>> pickle.dumps(foo, -1)
                  'x80x02c__main__
                  foo
                  qx00.'
                  

                  如果您有一个 FunctionType 对象,那么您需要做的就是获取该类的一个实例——即像 foo 这样的函数.

                  If you have a FunctionType object, then all you need to do is get one of the instances of that class -- i.e. a function like foo.

                  这篇关于酸洗错误:不能酸洗&lt;type 'function'&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Windows 上导入和使用使用多处理而不会导致无 下一篇:与 multiprocessing.Pool 共享一个计数器

                  相关文章

                  最新文章

                  <tfoot id='72pHO'></tfoot>

                    <small id='72pHO'></small><noframes id='72pHO'>

                    • <bdo id='72pHO'></bdo><ul id='72pHO'></ul>

                      <i id='72pHO'><tr id='72pHO'><dt id='72pHO'><q id='72pHO'><span id='72pHO'><b id='72pHO'><form id='72pHO'><ins id='72pHO'></ins><ul id='72pHO'></ul><sub id='72pHO'></sub></form><legend id='72pHO'></legend><bdo id='72pHO'><pre id='72pHO'><center id='72pHO'></center></pre></bdo></b><th id='72pHO'></th></span></q></dt></tr></i><div id='72pHO'><tfoot id='72pHO'></tfoot><dl id='72pHO'><fieldset id='72pHO'></fieldset></dl></div>
                    1. <legend id='72pHO'><style id='72pHO'><dir id='72pHO'><q id='72pHO'></q></dir></style></legend>