Hello All,

Is there a way to import module as __main__?

Say hw.py is:

    if __name__ == "__main__":
        print "Hello"

And the C code is (error handling omitted):

int
main(int argc, char *argv[])
{
    Py_Initialize();
    PySys_SetArgv(argc, argv);

    atexit(Py_Finalize);

    PyImport_ImportModule(module);
    return 0;
}

When importing hw using PyImport_ImportModule nothing is printed (as
expected). 
The documentation says that Py_Initialize already creates a __main__ module
and hw.py is imported as hw.

Any way to import hw as __main__?

Thanks.
--
------------------------------------------------------------------------
Miki Tebeka <[EMAIL PROTECTED]>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys

Attachment: pgpTrBHMvpC1T.pgp
Description: PGP signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to