Help On file IO

John Hunter jdhunter at nitace.bsd.uchicago.edu
Tue Jul 23 10:04:39 EDT 2002


>>>>> "jayant" == jayant kawadkar <jayantkawadkar at hotmail.com> writes:

    jayant>        I want a help on File IO ,as I 'm new to Python
    jayant> langauge.  As I want to use the API :
    jayant> 		char* PyModule_GetFilename(PyObject *module)
    jayant> 	in my python programm

    jayant>        What should I import for that I can use this .

    jayant>      Now it is giving the error that:
    jayant>                PyModule_GetFilename is not defined.

Did you include /some/dir/lib/your-python/config/config.c (eg.
/usr/local/lib/python2.1/config/config.c)?  This file includes
Python.h, which includes moduleobject.h which defines
PyModule_GetFilename.

You'll also need to link with the python system, eg 
/usr/local/lib/python2.1/config/libpython2.1.a

Take a look at http://www.python.org/doc/current/ext for more info.
The chapter "Extending and Embedding Python" in the *Python Essential
Reference* by David Beazley is also helpful.

John Hunter



More information about the Python-list mailing list