473,785 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 'PyRunSimpleFil e' Function.

Thanks in advance.

Anand

Jul 18 '05 #1
4 1955
Anand K Rayudu <an***@easi.sof t.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 'PyRunSimpleFil e' Function.

Thanks in advance.

Anand


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

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


William Park wrote:
Anand K Rayudu <an***@easi.sof t.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 'PyRunSimpleFil e' 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_GetD ynLoadFunc' function is failing.
And i also see following define. I am hoping this gives some info to
solve the issue.

#if defined(__hp900 0s300)
#define FUNCNAME_PATTER N "_init%.200 s"
#else
#define FUNCNAME_PATTER N "init%.200s "
#endif



Jul 18 '05 #3
Anand K Rayudu <an***@easi.sof t.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**********@y ahoo.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
2790
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 working with Python for a year or more now, but only doing simple extending in C/C++. I'm now attempting some embedding and several questions have come to mind. BTW - I'm running Windows 2000 with Python23 and VisualC++ developers
2
2870
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 embedded scripting language (a very limited one). I would like to rip it out and replace it with Python. I am thinking that this would be relatively simple since the scripting language is a very small interface between the UI and the engine --...
1
1920
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 questions about python embedding: 1) Is there a good text book or other resource on embedding/extending? (I find it hard to learn only by the tutorial and C/Python API from the python.org site)
6
3008
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 interface is providing a convenient scripting toolkit for the application. One example is that a user can write a python script like: player = Player() game.loadPlayer(player) player.moveTo(location)
0
2115
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 callback.setHandler1(callback1) this only seems to affect pythons ability to trigger an "event" in c. PyObject *Handler is always NULL even after I call Register_Handler(...). I thought there was some magic here that was assigning the pointer *Handler to my python...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9952
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.