November 13, 2006
-
Python 2.5 and SWIG 1.3.30
After hours of frustration, I figured out how to build C++ DLLs and link them into scripts for the latest version of Python (2.5).
The idea is that you may have developed some C++ code that you would like to be able to import into Python. There’s a really cool wrapper program called SWIG that helps you do just this. But with all of the latest updates to Python, SWIG broke, and so did the graphing library I was trying to use.
In short, if you are getting errors like:
ImportError: No module named _pymfg
(Your module name in place of _pymfg)
There are two things you should know.
- You may need to recompile your DLL using SWIG 1.3.30. Prior versions are incompatible with Python 2.5.
- You must to rename your DLL to PYD.
If you’re looking for a compiled version of the mfgraph library for Python 2.5, let me know.
Comments (11)
I don’t do any C++ development, but I’m working in Python nearly 24/7, so…. good to know!
just saw you came by my xanga
u nerd
Is it just me or is Xanga becoming more and more like it’s rivals, Facebook and Myspace?
Xanga just created “Networks” which is a distinct feature of Facebook.
Can Xanga be original for once rather than copy things from Facebook and Myspace? That would be nice!
Networks, email lists, groups of people, conventions, are all artifacts of societies and the way people think and operate. Not the creation of any .com.
are you single???if you are comment me.how old are you are you 24 or older because i know a 24 year old i want to meet you. are you interested???
Glad you found me by BOOST!!
Thanks, your method worked.
Ed Chen
Software Engineer for Intel at DuPont Washington
Thanks for the heads up about .PYD. Just wasted 2 hours because the stupid SWIG and Python docs don’t mention it.
Thanks Jeff. I tried your method and it works fine.
It is a fine day today. Cheap Air Jordan