473,701 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedding Python in MaxMSP

A pretty ugly one - embedding python in an external for a proprietary
semi-legacy macintosh application, MaxMSP:

I am trying to update Bill Orcutt's "nyptho" python interpreter
external for MaxMSP (http://www.publicbeta.cx/max/) to actually work
with the latest versions of OS X and python. Currently, the C calls
made by nyptho are to the older PyMac methods, and thus they depend on
the older MacPython distribution.

After some simple changes of the "nyptho" code to use the current
standard Python libraries instead, compilation seems to work fine, but
I am getting the following errors from the linker:

/usr/bin/gcc-3.3 -o "/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build/nyptho.mxo/Contents/MacOS/nyptho"
"-L/Users/tc1/Sources/MaxMSP-SDK/Mach-O Development/nyptho/build"
"-L/sw/lib/python2.3/config/" "-F/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build" "-F/Library/Frameworks" -filelist
"/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build/nyptho.build/nyptho.build/Objects-normal/LinkFileList"
"-framework" "Carbon" "-framework" "MaxAPI" "-arch" "ppc" "-bundle"
"-ldl"
ld: Undefined symbols:
_PyEval_InitThr eads
_PyRun_SimpleFi le
_PyRun_SimpleSt ring
_PySys_SetArgv
_Py_Finalize
_Py_Initialize

I am curious about the preceding underscores on the undefined symbols
- they are nowhere in the source code. I am very new to C, and am
using Mac's "XCode" IDE (as that's what the MaxMSP SDK examples are
in, and I haven't strayed far from them yet). Following Python's
linker instructions (http://python.org/doc/2.3.4/ext/link-reqs.html)
does nothing but add _PyMac_Error to the list of undefined symbols.

As I mentioned, I am very new to C, and especially don't know anything
about C++. But I feel like I'm so close to having something at least
testable here! Any ideas?

Thanks,
Charlie DeTar
Jul 18 '05 #1
1 2866
Oh, in case anyone out there cares or had the same problem at some
point: I was able to fix this by adding "-lpython2.3" to the ld command
list. Probably something to do with "Python.h" not corresponding to
"libpython. a"? Maybe there ought to be links
(libpython.a->libpython2.3.a ), so that embedded applications don't
depend on particular versions of python?

cheers,
Charlie

Charlie DeTar wrote:
[snip]
/usr/bin/gcc-3.3 -o "/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build/nyptho.mxo/Contents/MacOS/nyptho"
"-L/Users/tc1/Sources/MaxMSP-SDK/Mach-O Development/nyptho/build"
"-L/sw/lib/python2.3/config/" "-F/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build" "-F/Library/Frameworks" -filelist
"/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build/nyptho.build/nyptho.build/Objects-normal/LinkFileList"
"-framework" "Carbon" "-framework" "MaxAPI" "-arch" "ppc" "-bundle"
"-ldl"
ld: Undefined symbols:
_PyEval_InitThr eads
_PyRun_SimpleFi le
_PyRun_SimpleSt ring
_PySys_SetArgv
_Py_Finalize
_Py_Initialize

[snip]
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2510
by: jordi | last post by:
Hi, I'm starting to use Python embedded in a C program. I'm using Python to execute several scripts using as a variables information retrieved for several multithread "agents" written in C. The method is: 1- Create a thread for each agent (I use a pool thread, every agent run in a different thread) 2- Precompile a different script for each agent. 3- Make the agent retrieve its data
0
1844
by: Atul Kshirsagar | last post by:
I am embedding python in my C++ application. I am using Python *2.3.2* with a C++ extention DLL in multi-threaded environment. I am using SWIG-1.3.19 to generate C++ to Python interface. Now to explain it in details, 1. Python initialization and finalization is done in the *main* thread. 2. For each new thread I create a separate sub-interpreter . 3. Using PyRun_String("import myModule"...) before execution of python
23
2966
by: Robey Holderith | last post by:
Anyone know a good way to embed python within python? Now before you tell me that's silly, let me explain what I'd like to do. I'd like to allow user-defined scriptable objects. I'd like to give them access to modify pieces of my classes. I'd like to disallow access to pretty much the rest of the modules.
4
2786
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
2867
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
1913
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)
1
1833
by: Tommy Nordgren | last post by:
I want to write an application that embeds and extends (at least) the Python and Perl interpreters. Now i want to find as much as possible about the Python tools used for extending and embedding Python. To be more specific: My app should: 1. Parse an input file. 2. Call a script in some scripting language, to generate an output file, for example in C++. For task 2 I need to call an embedded interpreter, and also provide call backs from...
6
3002
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
2110
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
8732
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8649
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
9221
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
9082
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
8975
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
8933
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...
0
4410
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...
1
3102
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2398
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.