问答交流

【代码报错】RuntimeError: f_trace is not writable in Nuitka

由bqq6r4s1创建,最终由small_q 被浏览 23 用户

设置断点触发报错

你们好像是用了 nuitka 把 python 转成 c++


但这导致我在你们代码中,设置一个断点。然后调试单元格会报错。


下面是一个你们的均线的模版策略,



报错是这样:

\

  • RuntimeError: f_trace is not writable in Nuitka

  • --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) Cell In[1], line 181 143 m3 = M.extract_data_dai.v17( 144 sql=m2.data, 145 start_date="""2022-01-01""", (...) 151 m_name="""m3""" 152 ) 154 # @module(position="-359,-439", comment="""回测,K线处理""", comment_collapsed=False) 155 m4 = M.bigtrader.v25( 156 data=m3.data, 157 start_date="""""", 158 end_date="""""", 159 initialize=m4_initialize_bigquant_run, 160 before_trading_start=m4_before_trading_start_bigquant_run, 161 handle_tick=m4_handle_tick_bigquant_run, 162 handle_data=m4_handle_data_bigquant_run, 163 handle_trade=m4_handle_trade_bigquant_run, 164 handle_order=m4_handle_order_bigquant_run, 165 after_trading=m4_after_trading_bigquant_run, 166 capital_base=1000000, 167 frequency="""daily""", 168 product_type="""股票""", 169 rebalance_period_type="""交易日""", 170 rebalance_period_days="""1""", 171 rebalance_period_roll_forward=True, 172 backtest_engine_mode="""标准模式""", 173 before_start_days=0, 174 volume_limit=1, 175 order_price_field_buy="""open""", 176 order_price_field_sell="""close""", 177 benchmark="""沪深300指数""", 178 plot_charts=True, 179 debug=False, 180 backtest_only=False, --> 181 m_name="""m4""" 182 ) 183 # </aistudiograph> Cell In[1], line 181 143 m3 = M.extract_data_dai.v17( 144 sql=m2.data, 145 start_date="""2022-01-01""", (...) 151 m_name="""m3""" 152 ) 154 # @module(position="-359,-439", comment="""回测,K线处理""", comment_collapsed=False) 155 m4 = M.bigtrader.v25( 156 data=m3.data, 157 start_date="""""", 158 end_date="""""", 159 initialize=m4_initialize_bigquant_run, 160 before_trading_start=m4_before_trading_start_bigquant_run, 161 handle_tick=m4_handle_tick_bigquant_run, 162 handle_data=m4_handle_data_bigquant_run, 163 handle_trade=m4_handle_trade_bigquant_run, 164 handle_order=m4_handle_order_bigquant_run, 165 after_trading=m4_after_trading_bigquant_run, 166 capital_base=1000000, 167 frequency="""daily""", 168 product_type="""股票""", 169 rebalance_period_type="""交易日""", 170 rebalance_period_days="""1""", 171 rebalance_period_roll_forward=True, 172 backtest_engine_mode="""标准模式""", 173 before_start_days=0, 174 volume_limit=1, 175 order_price_field_buy="""open""", 176 order_price_field_sell="""close""", 177 benchmark="""沪深300指数""", 178 plot_charts=True, 179 debug=False, 180 backtest_only=False, --> 181 m_name="""m4""" 182 ) 183 # </aistudiograph> File _pydevd_bundle/pydevd_cython.pyx:1457, in _pydevd_bundle.pydevd_cython.SafeCallWrapper.call() File _pydevd_bundle/pydevd_cython.pyx:701, in _pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch() File _pydevd_bundle/pydevd_cython.pyx:1152, in _pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch() File _pydevd_bundle/pydevd_cython.pyx:1122, in _pydevd_bundle.pydevd_cython.PyDBFrame.trace_dispatch() File _pydevd_bundle/pydevd_cython.pyx:309, in _pydevd_bundle.pydevd_cython.PyDBFrame.set_suspend() File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/debugpy/_vendored/pydevd/pydevd.py:1892, in PyDB.set_suspend(self, thread, stop_reason, suspend_other_threads, is_pause, original_step_cmd) 1888 suspend_other_threads = True

    ...

    96 frame = None File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/debugpy/_vendored/pydevd/pydevd.py:2246, in PyDB.set_trace_for_frame_and_parents(self, frame, **kwargs) 2244 elif frame.f_trace is not self.trace_dispatch: 2245 pydev_log.debug('Set tracing of frame: %s - %s', frame.f_code.co_filename, frame.f_code.co_name) -> 2246 frame.f_trace = self.trace_dispatch 2247 else: 2248 pydev_log.debug('SKIP set tracing of frame: %s - %s', frame.f_code.co_filename, frame.f_code.co_name) RuntimeError: f_trace is not writable in Nuitka


请问我该怎么设置断点。并调试。

标签

Python
评论
  • 反馈了,这确实是一个问题,暂时没法修复,后续有修复我们通知你
{link}