def main(): # Starting the gui using the console script: 'golem gui' # won't work in windows there is a bug in windows when # starting the flask app from a console script # (setup.py, console_scripts) check out # https://github.com/pallets/werkzeug/issues/1136 # # In the meantime, for windows, ensure that the 'golem_start.py' # file is present otherwise create it first and use it to # kickstart golem. # TODO sys.dont_write_bytecode = True if os.name == 'nt': path = os.path.join(os.getcwd(), 'golem_start.py') if not os.path.isfile(path): golem_start_py_content = ("import os\n\n" "from golem.main import execute_from_command_line" "\n\n" "if __name__ == '__main__':\n" " execute_from_command_line(os.getcwd())\n") with open(path, 'w') as golem_start_file: golem_start_file.write(golem_start_py_content) del sys.argv[0] cmd_list = ['python', 'golem_start.py'] + sys.argv subprocess.call(cmd_list) else: execute_from_command_line(os.getcwd())
def main(): sys.dont_write_bytecode = True execute_from_command_line(os.getcwd())
pyinstaller golem/bin/golem_standalone.py --distpath . --onefile -n golem --add-data "golem/gui/templates:golem/gui/templates" --add-data "golem/gui/static:golem/gui/static" Note: use `;` (semi-colon) instead of `:` (colon) in Windows """ import os import sys from multiprocessing import freeze_support from golem.main import execute_from_command_line from golem.bin import golem_admin from webdriver_manager.main import main as webdriver_manager_main from golem.cli.messages import STANDALONE_USAGE if __name__ == '__main__': freeze_support() if len(sys.argv) > 1: if sys.argv[1] in ['golem-admin', 'admin']: del sys.argv[1] golem_admin.main() elif sys.argv[1] == 'webdriver-manager': del sys.argv[1] webdriver_manager_main() else: execute_from_command_line(os.getcwd()) else: print(STANDALONE_USAGE)
import os import sys # deactivate .pyc extention file generation sys.dont_write_bytecode = True if __name__ == "__main__": del sys.path[0] sys.path.append("") from golem.main import execute_from_command_line execute_from_command_line(os.getcwd())