Here's a CPython program that tries to initialize the interpreter with an empty
int main(int argc, char** argv)
wchar_t* program = NULL;
wchar_t* sys_path = NULL;
Py_NoSiteFlag = 1;
program = Py_DecodeLocale(argv, NULL);
sys_path = Py_DecodeLocale("", NULL);
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Current thread 0x00007ffff7fc6700 (most recent call first):
Signal: SIGABRT (Aborted)
These are packages/modules that are used during interpreter start-up (as, @Charles Duffy noted in a comment, by looking in
The result depends on whether you have
site enabled or not (your
Py_NoSiteFlag = 1; implies this isn't the case but anyway, I'll give both options :-).
site enabled, you could run Python using the following:
abc.py encodings os.py _sitebuiltins.py sysconfig.py codecs.py genericpath.py posixpath.py site.py _collections_abc.py io.py stat.py _weakrefset.py
site disabled, you're stripped down to the following
abc.py codecs.py encodings io.py os.py _weakrefset.py
when invoked through
Py_Initialize() I'm guessing
os.py might not be actually needed.