473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

embedding python

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
4 1939
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


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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been...
2
by: Roose | last post by:
With some googling I have found these resources: http://docs.python.org/ext/win-dlls.html http://www.python.org/doc/faq/windows.html I have a large Win32/MFC/C/C++ application that has an...
1
by: amit | last post by:
Hello, I am currently studying how to embedd python. I am developing a graphical C++ application. My goal is to embedd python script that will control some kind of animation. I have some...
6
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.