Import error while running python application on Mac OS

Ned Deily nad at acm.org
Thu Jun 9 15:34:45 EDT 2011


In article 
<1167f414-8901-4f9c-9d51-2723213fd036 at k3g2000prl.googlegroups.com>,
 hisan <santosh.ssit at gmail.com> wrote:

> On Jun 8, 9:20 pm, hisan <santosh.s... at gmail.com> wrote:
> > I have created an application for Mac OS using py2app module, in my
> > python script i have external modules such as MySQLdb and other ,
> > while trying to run on Mac OS i get an error saying unable to import
> > the module MySQLdb.
> > On Windows i convert python script to an exe using py2exe module and
> > if i install VC++ on y machine my exe runs fine.
> > Is there any dependency on MAC OS.
> Can Some one reply for this Please

You will want to ask questions about Python on Mac OS X on the Pythonmac 
list.

http://dir.gmane.org/gmane.comp.python.apple

But you need to supply more information.  There are many reasons why you 
might get an import error.  You should supply the exact traceback from 
the failing import and say which Python instance you are using, which 
version of MySQLdb, which set of MySQL client libraries - all of which 
need to be built compatibly (i.e. compatible CPU archs and deployment 
targets) and packaged in the app bundle or installed externally on the 
end user's machine.  You need to specify what version of OS X you are 
using and what range of OS X versions your app is targeted for.  And you 
should say whether everything works without trying to use py2app.  
Getting a working combination of python, MySQLdb, and MySQL client libs 
on OS X can be frustrating if you try to guess at it or use binaries 
from different suppliers.  If possible, use a complete solution from a 
3rd-party open source packager, like MacPorts or Homebrew.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list