无法将文件解释为泡菜(numpy)

时间:2018-11-28 02:54:48

标签: python numpy pycharm

我正在尝试使用openbte(https://pypi.org/project/openbte/),但我一直从假设为numpy的错误消息中不断获取此特定错误:

<?xml version="1.0" encoding="UTF-8"?>
<mnop:Employee_Details xmlns:mnop="urn:com.abcdef/mnop">
    <mnop:Summary>
        <mnop:Integration_Event>c01598f8f45bbb10</mnop:Integration_Event>
        <mnop:Integration_Sent_On>2018-11-01T13:41:28.594-07:00</mnop:Integration_Sent_On>
        <mnop:Restricted_to_Organizations mnop:size="1">
            <mnop:Organization>
                <mnop:Organization_Name>Marketing & Sales &amp; Archives</mnop:Organization_Name>
                <mnop:Organization_Type>Supervisor</mnop:Organization_Type>
                <mnop:Organization_Reference_ID/>
            </mnop:Organization>
        <mnop:Version>1</mnop:Version>
    </mnop:Summary>
</mnop:Employee_Details>

似乎无法将“ .cache / HW_PLUS_1.np”中的文件解释为泡菜。但是,深入研究代码,我发现所有文件都按以下方式保存:

Traceback (most recent call last):
  File "C:\Python27\Lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Users\turtl\PycharmProjects\27\venv\Scripts\openbte.exe\__main__.py", line 9, in <module>
  File "c:\users\turtl\pycharmprojects\27\venv\lib\site-packages\openbte\__main__.py", line 53, in main
    Solver(**vars(args))
  File "c:\users\turtl\pycharmprojects\27\venv\lib\site-packages\openbte\solver.py", line 91, in __init__
    self.compute_function(**argv)
  File "c:\users\turtl\pycharmprojects\27\venv\lib\site-packages\openbte\solver.py", line 458, in compute_function
    'suppression_zeroth':suppression_zeroth.copy()})
  File "c:\users\turtl\pycharmprojects\27\venv\lib\site-packages\openbte\utils.py", line 79, in compute_sum
    compute_serial_sum(func,n_tot,output,options)
  File "c:\users\turtl\pycharmprojects\27\venv\lib\site-packages\openbte\utils.py", line 13, in compute_serial_sum
    tmp = func(n,options)
  File "c:\users\turtl\pycharmprojects\27\venv\lib\site-packages\openbte\solver.py", line 231, in solve_bte
    HW_PLUS = np.load(open(self.cache +'/HW_PLUS_' + str(index) +r'.np','r'))
  File "c:\users\turtl\pycharmprojects\27\venv\lib\site-packages\numpy\lib\npyio.py", line 443, in load
    "Failed to interpret file %s as a pickle" % repr(file))
IOError: Failed to interpret file <open file '.cache/HW_PLUS_1.np', mode 'r' at 0x000000001A7D19C0> as a pickle

然后像这样加载:

   HW_minus.dump(open(self.cache + '/HW_MINUS_' + str(index) +r'.np','w+'))
   HW_plus.dump(open(self.cache + '/HW_PLUS_' + str(index) +r'.np','w+'))

我还尝试遵循该过程,发现它已成功加载

'。cache / HW_MINUS 0.np'

'。cache / HW_PLUS_0.np'

'。cache / HW_MINUS 1.np'

,但是在“ .cache / HW_PLUS_1.np”上失败,尽管它们都保存和加载相同。有谁知道为什么会这样以及如何解决?帮助将不胜感激。

0 个答案:

没有答案