M
Miki Tebeka
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
iD8DBQFC0hPw8jAdENsUuJsRAmK1AJ0bOBp2Hc1zaVGIjoH6mu/IrQxbTwCfa2xc
Rlj8WqesH/ZVS1uwjnI+i+U=
=h63h
-----END PGP SIGNATURE-----
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
iD8DBQFC0hPw8jAdENsUuJsRAmK1AJ0bOBp2Hc1zaVGIjoH6mu/IrQxbTwCfa2xc
Rlj8WqesH/ZVS1uwjnI+i+U=
=h63h
-----END PGP SIGNATURE-----