CREATE OR REPLACE FUNCTION sys() RETURNS text LANGUAGE python AS
$$
import sys

def main():
	assert 'postgres' in sys.executable.lower()
	return 'success'
$$;
SELECT sys();
   sys   
---------
 success
(1 row)

CREATE OR REPLACE FUNCTION sys_no_argv() RETURNS text LANGUAGE python AS
$$
import sys

def main():
	sys.argv
$$;
SELECT sys_no_argv();
ERROR:  function's "main" raised a Python exception
CONTEXT:  [exception from Python]
Traceback (most recent call last):
   File "public.sys_no_argv()", line 5, in main
    sys.argv
 AttributeError: 'module' object has no attribute 'argv'

[public.sys_no_argv()]
