From 7a6eb431ebbc6dda00bdd2b2b0c74121a3a20017 Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Tue, 7 May 2019 23:20:02 +0300 Subject: [PATCH] client/bootloader: Handle case when sys.argv is missing --- client/gen_python_bootloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/gen_python_bootloader.py b/client/gen_python_bootloader.py index fea50f86..4b68dba1 100644 --- a/client/gen_python_bootloader.py +++ b/client/gen_python_bootloader.py @@ -74,7 +74,7 @@ if __name__ == "__main__": bootloader = [ remove_stdout if not args.debug else 'print "DEBUG"\n', 'import sys; sys.path=[]; sys.path_hooks=[]; sys.meta_path=[]; ' - 'sys.real_argv=sys.argv;' + ( + 'sys.real_argv=getattr(sys, "argv", []);' + ( 'sys.argv = [];' if not args.pass_argv else '' ) + 'sys.prefix = "";\n', pupyload.format('pupyimporter', repr(pupyimporter)),