Skip to content

Commit 4cfbba2

Browse files
committed
feat:1.If the run method in blockly contains empty code, add "pass"
1 parent 7e0092e commit 4cfbba2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

xarm/tools/blockly/_blockly_tool.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ def _finish_robot_main_run_codes(self, error_exit=True, stop_exit=True):
9797
self._append_main_code(' # Event Loop', indent=-1)
9898
self._append_main_code(' while self.is_alive:', indent=-1)
9999
self._append_main_code(' time.sleep(0.5)', indent=-1)
100+
101+
if self._is_main_run_code and (self._main_run_code_list[-1] == ' try:' or ' # ' in self._main_run_code_list[-1]):
102+
self._append_main_code(' pass', indent=-1)
100103
# catch exception and release callback
101104
self._append_main_code(' except Exception as e:', indent=-1)
102105
self._append_main_code(' self.pprint(\'MainException: {}\'.format(e))', indent=-1)

0 commit comments

Comments
 (0)