def upload_current_script():
current_editor = get_workbench().get_editor_notebook().get_current_editor()<EOL>code = current_editor.get_text_widget().get("<STR_LIT:1.0>", "<STR_LIT:end>")<EOL>try:<EOL><INDENT>filename= current_editor.get_filename()<EOL>if (not filename) or (not filename.endswith("<STR_LIT>")):<EOL><INDENT>return<EOL><DEDENT>ast.parse(code)<EOL>if not code.startswith('<STR_LIT>'):<EOL><INDENT>if tkMessageBox.askokcancel("<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>current_editor.get_text_widget().direct_insert("<STR_LIT:1.0>", "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>return<EOL><DEDENT><DEDENT>py_file = current_editor.save_file(False)<EOL>if py_file is None:<EOL><INDENT>return<EOL><DEDENT>upload(py_file)<EOL><DEDENT>except Exception:<EOL><INDENT>error_msg = traceback.format_exc(<NUM_LIT:0>)+'<STR_LIT:\n>'<EOL>showerror("<STR_LIT>", error_msg)<EOL><DEDENT>
upload current python script to EV3