By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,660 Members | 1,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,660 IT Pros & Developers. It's quick & easy.

embedding python

P: n/a
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

Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Anand K Rayudu <an***@easi.soft.net> wrote:
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

--
William Park, Open Geometry Consulting, <op**********@yahoo.ca>
Linux solution for data management and processing.
Jul 18 '05 #2

P: n/a


William Park wrote:
Anand K Rayudu <an***@easi.soft.net> wrote:

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



Jul 18 '05 #3

P: n/a
Anand K Rayudu <an***@easi.soft.net> wrote:
Did you compile with '-lm' ?
Eg:
http://home.eol.ca/~parkw/index.html


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. :-)

--
William Park, Open Geometry Consulting, <op**********@yahoo.ca>
Linux solution for data management and processing.
Jul 18 '05 #4

P: n/a

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

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. :-)

Yes I figured it out, are u also trying on HP machines? Bacause it works
fine on all other platforms!!!


Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.