473,651 Members | 2,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Connection in MySQLdb and Python in MAC OS X.

8 New Member
Hi,
I'm doing a small project on Python using MySQL as Database in MAC OS X.
I was unable to connect the database. I was downloaded MySQLdb from sourceforge.net and I also modified setup_posix.py. After modified and restart the setup.py I'm getting an error "gcc" cannot find the file.
This is the error it was getting when I was reinstalling the setup.py
"Administrator: MySQL-python-1.2.2 administrator$ sudo python setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.eg g-info/PKG-INFO
writing top-level names to MySQL_python.eg g-info/top_level.txt
writing dependency_link s to MySQL_python.eg g-info/dependency_link s.txt
reading manifest file 'MySQL_python.e gg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.e gg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.3-fat/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.3-fat-2.5/MySQLdb
running build_ext
building '_mysql' extension
gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=( 1,2,2,'final',0 ) -D__version__=1. 2.2 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framewor k/Versions/2.5/include/python2.5 -c _mysql.c -o build/temp.macosx-10.3-fat-2.5/_mysql.o -g -Os -arch i386 -fno-common -D_P1003_1B_VISI BLE -DSIGNAL_WITH_VI O_CLOSE -DSIGNALS_DONT_B REAK_READ -DIGNORE_SIGHUP_ SIGQUIT -DDONT_DECLARE_C XA_PURE_VIRTUAL
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1"
Please suggest me what to do and how to go further....
Thank You in advance for Your suggestion and help me.
Warm Regards,
Srinivas.
Feb 6 '09 #1
1 2946
cnivas
8 New Member
Hi,

Follow the steps to connect the MySQL database using Python:

1) first download the mysql-python 1.2.2 from sourceforge.net

2)modify the setup_posix.py line numbers:29,35

from mysql_config.pa th="mysql_confi g"

to

mysql_config.pa th = "/usr/local/mysql/bin/mysql_config"

3) save the file and now go to terminal

admin:~admin$ sudo python setup.py install

if u get gcc error then download the gcc from xcode tools
or else u have mac cds with u. In that keep 2nd cd in the disk and install the xcode tools from it.

4) please download the pyshell from sourceforge.net here is the link....

http://sourceforge.net/projects/pyshell/

5) copy the pyshell from downloaded to Library->Frameworks->Python.Framewo rk->paste it.

6) Open the pyshell.py and close it.

7) now do the following step:

admin:~admin$ sudo python setup.py install

u will not get any gcc error.

8) open the idle from Python 2.5 or 2.6 not the python launcher.......

>>> import MySQLdb
>>>

u will get this it means MySQLdb was connected....

Keep enjoying.......
Feb 13 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2096
by: Dave Harrison | last post by:
Hi all, got a problem combinging mx and MySQLdb, when I build and install both for my Python2.1 install on a Solaris 9 box I can import mx fine, but importing MySQLdb causing python to core dump. I am using egenenix 2.0.4 and MySQLdb 0.9.2. I have also replaced the -shared flag in the Makefile is /usr/local/lib/Python2.1/config with -G (a recommended solaris change to let the build of the modules work in the first place) -> notably I also...
1
6115
by: Kiran B. | last post by:
hello, Im getting this error everytime i load this page. malformed header from script. Bad header=*** You don't have the (right): c:/program files/apache group/apache/cgi-bin/fig28_18.py I have connected all databases already. If I remove the import MySQL statement, theres no problem. But i need to use the database. . what could possibly be wrong???
1
2997
by: Derek Fountain | last post by:
I was trying to use MySQLdb to connect to a database. All is OK, except I can't figure out how to get the details of an error. Suppose I try to connect to a non existant server, or with the wrong password - how do I get a meaningful error message which I can present to my user?
3
2412
by: Paul M | last post by:
I encountered the following error when trying to perform a SQL UPDATE to a MySQL database table from Python. I would apprciate any assistance. In the Python code I have tried integer and decimal format specifiers in addition to the string specifier and nothing worked. Traceback (most recent call last): File "e:\my_python_scripts\commercecraft.py", line 36, in ? cursor.execute ("UPDATE product SET price = '%s' WHERE competitorID=1
2
1606
by: Josh | last post by:
Hi, First off, I am a newbie to Python and so far I must say that we're getting along pretty well. My schooling was is C/C++, but have been writing code in, dare I say it, VB, for the past 4 years. Here is the problem I have run across. I am using SPE w/WXGlade to setup the GUI, so it handled the initial formatting of my python code as two seperate classes, one for the APP and one for the Frame. I'll be the first to admit I haven't...
0
1179
by: Bernard Lebel | last post by:
Hello, First, this is my first post on this list! A little about myself: I'm the lead technical director in a 3D animation studio, in Montreal. A lot of the Python code I write is to be used in an application that embeds Python, that is, Softimage|XSI. Right now I'm re-writing the render farm software that runs on render nodes, in this project is what made me learn Python in the first place. My first question is related to that. :-)
1
3368
by: Yi Xing | last post by:
I log into the machine remotely. How do I check the Mac OSX version number under command line? Thanks. hiaips rosedb0 at gmail.com Wed Aug 16 01:23:10 CEST 2006 * Previous message: MySQLdb installation error * Next message: What would be the best way to run python client in the background
0
2078
by: Michael Boldin via alt email | last post by:
I installed python 2.5 and used the win package for installing MySQLdb. (Iam running Windows XP) Everything works as expected using python directly (Windows command shell) but using IDLE gives the import error below. Same error with PythonWin as my IDE and everything works using python 2.4-- with IDLE and without, mySQLdb is loaded with out error. Below is the IDLEscreen capture Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) on win32...
3
1640
by: int32bit | last post by:
I can't figure out why this doesn't work. Any ideas appreciated. conn = MySQLdb.connect (db = "vocab") cursor = conn.cursor () cursor.execute ("SELECT VERSION()") row = cursor.fetchone () print "server version:", row cursor.close () conn.close ()
0
8357
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
8277
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
8803
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...
1
8465
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
8581
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
7298
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
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
5612
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
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.