VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 13
声望: 0

Traceback (most recent call last):
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 756, in _write_bytes
self._sock.sendall(data)
ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\vnstudio\lib\site-packages\peewee.py", line 3129, in execute_sql
cursor.execute(sql, params or ())
File "D:\vnstudio\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "D:\vnstudio\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 547, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 814, in _execute_command
self._write_bytes(packet)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 760, in _write_bytes
CR.CR_SERVER_GONE_ERROR, "MySQL server has gone away (%r)" % (e,)
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionAbortedError(10053, '你的主机中的软件中止了一个已建立的连接。', None, 10053, None))")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\vnstudio\lib\site-packages\vnpy\database\mysql\mysql_database.py", line 35, in execute_sql
cursor = super(RetryOperationalError, self).execute_sql(sql, params, commit)
File "D:\vnstudio\lib\site-packages\peewee.py", line 3136, in execute_sql
self.commit()
File "D:\vnstudio\lib\site-packages\peewee.py", line 2902, in exit
reraise(new_type, new_type(exc_value, *exc_args), traceback)
File "D:\vnstudio\lib\site-packages\peewee.py", line 185, in reraise
raise value.with_traceback(tb)
File "D:\vnstudio\lib\site-packages\peewee.py", line 3129, in execute_sql
cursor.execute(sql, params or ())
File "D:\vnstudio\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "D:\vnstudio\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 547, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 814, in _execute_command
self._write_bytes(packet)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 760, in _write_bytes
CR.CR_SERVER_GONE_ERROR, "MySQL server has gone away (%r)" % (e,)
peewee.OperationalError: (2006, "MySQL server has gone away (ConnectionAbortedError(10053, '你的主机中的软件中止了一个已建立的连接。', None, 10053, None))")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\vnstudio\lib\site-packages\vnpy\database\mysql\mysql_database.py", line 185, in save_bar_data
DbBarData.insert_many(c).on_conflict_replace().execute()
File "D:\vnstudio\lib\site-packages\peewee.py", line 1898, in inner
return method(self, database, *args, **kwargs)
File "D:\vnstudio\lib\site-packages\peewee.py", line 1969, in execute
return self._execute(database)
File "D:\vnstudio\lib\site-packages\peewee.py", line 2730, in _execute
return super(Insert, self)._execute(database)
File "D:\vnstudio\lib\site-packages\peewee.py", line 2465, in _execute
cursor = database.execute(self)
File "D:\vnstudio\lib\site-packages\peewee.py", line 3142, in execute
return self.execute_sql(sql, params, commit=commit)
File "D:\vnstudio\lib\site-packages\vnpy\database\mysql\mysql_database.py", line 38, in execute_sql
self.close()
File "D:\vnstudio\lib\site-packages\peewee.py", line 3083, in close
raise OperationalError('Attempting to close database while '
peewee.OperationalError: Attempting to close database while transaction is open.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\vnstudio\lib\site-packages\peewee.py", line 3286, in rollback
return self._state.conn.rollback()
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 479, in rollback
self._execute_command(COMMAND.COM_QUERY, "ROLLBACK")
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 793, in _execute_command
raise err.InterfaceError(0, "")
pymysql.err.InterfaceError: (0, '')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\vnstudio\lib\site-packages\vnpy\app\data_manager\ui\widget.py", line 591, in download
count = self.engine.download_bar_data(symbol, exchange, interval, start)
File "D:\vnstudio\lib\site-packages\vnpy\app\data_manager\engine.py", line 206, in download_bar_data
database_manager.save_bar_data(data)
File "D:\vnstudio\lib\site-packages\vnpy\database\mysql\mysql_database.py", line 185, in save_bar_data
DbBarData.insert_many(c).on_conflict_replace().execute()
File "D:\vnstudio\lib\site-packages\peewee.py", line 4158, in exit
return self._helper.exit(exc_type, exc_val, exc_tb)
File "D:\vnstudio\lib\site-packages\peewee.py", line 4189, in exit
self.rollback(False)
File "D:\vnstudio\lib\site-packages\peewee.py", line 4176, in rollback
self.db.rollback()
File "D:\vnstudio\lib\site-packages\peewee.py", line 3286, in rollback
return self._state.conn.rollback()
File "D:\vnstudio\lib\site-packages\peewee.py", line 2902, in exit
reraise(new_type, new_type(exc_value, *exc_args), traceback)
File "D:\vnstudio\lib\site-packages\peewee.py", line 185, in reraise
raise value.with_traceback(tb)
File "D:\vnstudio\lib\site-packages\peewee.py", line 3286, in rollback
return self._state.conn.rollback()
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 479, in rollback
self._execute_command(COMMAND.COM_QUERY, "ROLLBACK")
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 793, in _execute_command
raise err.InterfaceError(0, "")
peewee.InterfaceError: (0, '')

参考这个网页中的修改还是一样

Member
avatar
加入于:
帖子: 3469
声望: 228

请问参考了哪个网页进行修改?

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

https://blog.csdn.net/midion9/article/details/100562651

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

没改时,数据管理这个界面,第一次下载历史成功,关闭界面,第二次打开时数据库连接就断了

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

以前自己写的断线重连是类似这样的代码,但在VNPY中没找到在哪改
def execute_db(self, sql):
try:

    # 检查连接是否断开,如果断开就进行重连
    self.conn.ping(reconnect=True)
    self.cur.execute(sql)
    self.conn.commit()
except Exception as e:
    print("操作出现错误:{}".format(e))
    self.conn.rollback()
Member
avatar
加入于:
帖子: 13
声望: 0

数据管理界面第一次正常,下载也正常,过几分钟打开就出错了
Traceback (most recent call last):
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 756, in _write_bytes
self._sock.sendall(data)
ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\vnstudio\lib\site-packages\peewee.py", line 3129, in execute_sql
cursor.execute(sql, params or ())
File "D:\vnstudio\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "D:\vnstudio\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 547, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 814, in _execute_command
self._write_bytes(packet)
File "D:\vnstudio\lib\site-packages\pymysql\connections.py", line 760, in _write_bytes
CR.CR_SERVER_GONE_ERROR, "MySQL server has gone away (%r)" % (e,)
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionAbortedError(10053, '你的主机中的软件中止了一个已建立的连接。', None, 10053, None))")

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

修改peewee
增加self._state.conn.ping(reconnect=True)
没问题了,但感觉不该在这改。。。

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

solmyr wrote:

修改peewee
增加self._state.conn.ping(reconnect=True)
没问题了,但感觉不该在这改。。。

大哥,请问你是在哪下载数据啊,我也想下载!

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

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】