embedding python

A

Anand K Rayudu

Hi All,

I have one problem with embedding python into my application.
on HP-UX11 i created my application with linking libPython2.3.a
And with my product i supply all extension dlls [ .so] and with
appropriate PYTHONHOME and PYTHONPATH set.

Every thing is fine till i import math,
When i import math [ For all extension modules ]
I get following error.
import math
ImportError: dynamic module does not define init function (initmath)

But if i run python in shell it works fine,
I am sure it is some thing to do with my application linking or some
thing like that.
Could some one please suggest, how to solve this problem.

It works fine on all other platforms.
I call python using 'PyRunSimpleFile' Function.

Thanks in advance.

Anand
 
W

William Park

Anand K Rayudu said:
Hi All,

I have one problem with embedding python into my application.
on HP-UX11 i created my application with linking libPython2.3.a
And with my product i supply all extension dlls [ .so] and with
appropriate PYTHONHOME and PYTHONPATH set.

Every thing is fine till i import math,
When i import math [ For all extension modules ]
I get following error.
import math
ImportError: dynamic module does not define init function (initmath)

But if i run python in shell it works fine,
I am sure it is some thing to do with my application linking or some
thing like that.
Could some one please suggest, how to solve this problem.

It works fine on all other platforms.
I call python using 'PyRunSimpleFile' Function.

Thanks in advance.

Anand

Did you compile with '-lm' ?
Eg:
http://home.eol.ca/~parkw/index.html
 
A

Anand K Rayudu

William said:
Hi All,

I have one problem with embedding python into my application.
on HP-UX11 i created my application with linking libPython2.3.a
And with my product i supply all extension dlls [ .so] and with
appropriate PYTHONHOME and PYTHONPATH set.

Every thing is fine till i import math,
When i import math [ For all extension modules ]
I get following error.
import math
ImportError: dynamic module does not define init function (initmath)

But if i run python in shell it works fine,
I am sure it is some thing to do with my application linking or some
thing like that.
Could some one please suggest, how to solve this problem.

It works fine on all other platforms.
I call python using 'PyRunSimpleFile' Function.

Thanks in advance.

Anand

Did you compile with '-lm' ?
Eg:
http://home.eol.ca/~parkw/index.html
Hi William,

Thanks for the help, I compiled with -lm , It did not work!!
Probably i need to re-compile python with -DEMBED_PYTHON option as you
suggested.
As the python error suggests, it could load the dynamic library, but
could not find 'initmath' symbol in the library.
looks like '_PyImport_GetDynLoadFunc' function is failing.
And i also see following define. I am hoping this gives some info to
solve the issue.

#if defined(__hp9000s300)
#define FUNCNAME_PATTERN "_init%.200s"
#else
#define FUNCNAME_PATTERN "init%.200s"
#endif
 
W

William Park

Anand K Rayudu said:
Thanks for the help, I compiled with -lm , It did not work!!
Probably i need to re-compile python with -DEMBED_PYTHON option as you
suggested.

No. '-DEMBED_PYTHON' is just for my patch, which embeds Python in Bash
shell. It's one example of embedding and compiling. Since I can do
math, there must be something I'm doing that you're not. :)
 
A

Anand K Rayudu

No. '-DEMBED_PYTHON' is just for my patch, which embeds Python in Bash
shell. It's one example of embedding and compiling. Since I can do
math, there must be something I'm doing that you're not. :)
Yes I figured it out, are u also trying on HP machines? Bacause it works
fine on all other platforms!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,947
Members
47,501
Latest member
Ledmyplace

Latest Threads

Top