我对 python 很陌生,我正在编写一个从与我一起工作的人那里继承的 python 脚本,我收到了这个错误:
expected a readable buffer object
造成这种情况的代码是:
self.y_NoShock_data = np.zeros((self.a_count+1,1,self.numberOfTags+1,lookback+forward,),dtype=enums.
self.y_data = np.zeros((self.a_count+1,len(self.SCL)+1,self.numberOfTags+1,lookback+forward,),dtype=enums.DataPoints)
self.y_NoShock_cum_data = np.zeros_like(self.y_NoShock_data)
self.y_cum_data = np.zeros_like(self.y_data)
enums.DataPoints 看起来像这样:
enums.DataPoints = dtype([
('Amount','float32'),
])
堆栈跟踪如下:
Internal Server
Error: /smCore/entity/1/runScenarioManager/
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/Users/bentaliadoros/Documents/workspace/LivingSvnAmmar/trunk/ScenarioManagerStandAlone/smCore/views/createScenario.py", line 445, in runScenarioManager
a = ScenarioExecutionController(sEA)
File "/Users/bentaliadoros/Documents/workspace/LivingSvnAmmar/trunk/ScenarioManagerStandAlone/smCore/models/scenarioExecutionController.py", line 176, in __init__
shockEventDataSet=[], lookback=self.lookback, forward=self.forward, period=self.period) #,
File "/Users/bentaliadoros/Documents/workspace/LivingSvnAmmar/trunk/ScenarioManagerStandAlone/smCore/models/scenarioExecution.py", line 307, in buildSeedScenarioObject
cls.updateScenarioParameters(shockContainerList,shockEventDataSet, shockEventDateList)
File "/Users/bentaliadoros/Documents/workspace/LivingSvnAmmar/trunk/ScenarioManagerStandAlone/smCore/models/scenarioExecution.py", line 130, in updateScenarioParameters
self.initialiseResultArrays()
File "/Users/bentaliadoros/Documents/workspace/LivingSvnAmmar/trunk/ScenarioManagerStandAlone/smCore/models/scenarioExecution.py", line 154, in initialiseResultArrays
self.y_NoShock_cum_data = np.zeros_like(self.y_NoShock_data,dtype=enums.DataPoints)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/numeric.py", line 116, in zeros_like
res.fill(0)
TypeError: expected a readable buffer object
他在电脑上工作,而我在 Mac 上工作。我一直在环顾四周,但找不到解决方案,谁能指出我正确的方向?