error

John Machin sjmachin at lexicon.net
Tue Sep 12 09:15:14 EDT 2006


prashant.burghate at wipro.com wrote:
> Hi,
>
> Today is my first day of working on python. I want to execute python
> script through C++ program. I found one very good article with example
> at http://docs.python.org/ext/pure-embedding.html.
> I followed the procedure as given, the code is compiled but while
> running it is giving error like:
> ImportError: No module named multiply
> Failed to load "multiply"
>
> Here are the steps I followed, please suggest where I am wrong and how
> can I remove the above error.
>
> Step 1: Copied the given C program into a file called test.cpp (using vi
> editor)
> Step 2: Compiled it using : g++ test.cpp  /usr/lib/libpython2.4.so
> (created a.out)
> Step 3: Wrote the given script of multipication in a file named as
> multiply (using vi editor)

Try naming your source file multiply.py but continue to use the module
name (multiply) in the command line.  [Note: you could have a binary
extension module called multiply in a binary file called multiply.so]

I guess the author of that manual section didn't contemplate somebody
on their first day with Python doing some embedding :-)

HTH,
John




More information about the Python-list mailing list