vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 13
声望: 0

2019-07-08 21:21:33,411 INFO: 启动CTA策略守护父进程
2019-07-08 21:21:33,413 INFO: 启动子进程
2019-07-08 21:21:33,434 INFO: 子进程启动成功
2019-07-08 21:21:35,292 INFO: 启动CTA策略运行子进程
2019-07-08 21:21:35,292 INFO: 事件引擎创建成功
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\py2\lib\multiprocessing\process.py", line 267, in _bootstrap
self.run()
File "C:\ProgramData\Anaconda3\envs\py2\lib\multiprocessing\process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "C:\vnpy-1.9.2\examples\CtaTrading_RBT_m\runCtaTrading_RBT_m.py", line 59, in runChildProcess
me = MainEngine(ee)
File "C:\ProgramData\Anaconda3\envs\py2\lib\site-packages\vnpy\trader\vtEngine.py", line 39, in init
self.dataEngine = DataEngine(self.eventEngine)
File "C:\ProgramData\Anaconda3\envs\py2\lib\site-packages\vnpy\trader\vtEngine.py", line 428, in init
self.loadContracts()
File "C:\ProgramData\Anaconda3\envs\py2\lib\site-packages\vnpy\trader\vtEngine.py", line 549, in loadContracts
print('f is: ', f)
File "C:\ProgramData\Anaconda3\envs\py2\lib\UserDict.py", line 205, in repr
return repr(dict(self.iteritems()))
File "C:\ProgramData\Anaconda3\envs\py2\lib\UserDict.py", line 144, in iteritems
yield (k, self[k])
File "C:\ProgramData\Anaconda3\envs\py2\lib\shelve.py", line 122, in getitem
value = Unpickler(f).load()
UnpicklingError: invalid load key, '

请问:大家伙遇到过这error吗?知道咋整不?

Member
avatar
加入于:
帖子: 13
声望: 0

我初步分析,应该是我的ContractData.vt文件坏了
用了shelve打开,检查‘data’是否在文件内,返回True
调‘data’键对应的value,报错

broken = shelve.open('e:\dataProcess\ContractData.vt')
print('data' in broken)
print(broken.keys())
print(broken['data'])

out:
True
['data']
Traceback (most recent call last):

File "<ipython-input-84-de2d435086df>", line 3, in <module>
print(broken['data'])

File "C:\ProgramData\Anaconda3\envs\py2\lib\shelve.py", line 122, in getitem
value = Unpickler(f).load()

UnpicklingError: invalid load key, '

Member
avatar
加入于:
帖子: 13
声望: 0

只是,这vt文件怎么就坏了呢?我对比它和其他vt文件,它膨胀到了大约4m,其他的就2m左右,它怎么就比别的大一倍呢?我一直就没有去修改,甚至都没有打开过temp文件夹。到底细怎么肥事呢?

Administrator
avatar
加入于:
帖子: 1711
声望: 80

可能是之前异常关闭程序导致的(写入修改时退出进程),就会导致文件损坏,删了就会重新初始化

Member
avatar
加入于:
帖子: 13
声望: 0

好啊,谢谢!

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3