tags:

views:

129

answers:

2

I am using Python 2.6.1, MySQL4.0 in Windows platform and I have successfully installed MySQLdb.

Do we need to set any path for my python code and MySQLdb to successful run my application? Without any setting paths (in my code I am importing MySQLdb) I am getting No module named MySQLdb error is coming and I am not able to move further.

A: 

How did you install MySQLdb? This sounds like your MySQLdb module is not within your PYTHONPATH which indicates some inconsistancy between how you installed Python itself and how you installed MySQLdb.

Or did you perhaps install a MySQLdb binary that was not targeted for your version of Python? Modules are normally put into version-dependant folders.

Horst Gutmann
I have downloaded from http://www.codegood.com/archives/4 this site and installed, MySQLdb is there C:\Python26\Lib\site-packages in this path. how can know that MySQLdb binary that was not targeted for your version of Python?
SKSK
Which of these packages did you install? I just tried it with http://www.codegood.com/download/4/ (1.2.3rc1-win32) and I could load the module.
Horst Gutmann
Hi Gutmann, I tried which you specified above link but still its coming same Error.I am using simple code with import MySQLdb, not using any complex code also
SKSK
Does it also refuse to work when you're using IDLE? Could you perhaps post the content of your sys.path?
Horst Gutmann
I am very new to Python. can u plz tell me where I can see the sys.path? But through command prompt wen to c:\Python26>python and >>> import MYSQLdb it running fine with out any errorsBut through code its giving error, how I have set path and where?
SKSK
A: 

no, it is generally not required (not for good mannered modules like MySQLdb).

did you check my answer to your previous question http://stackoverflow.com/questions/1135625/connecting-python-2-6-1-with-mysqldb

mariotomo
Yes, I have seen and I did how u said (I used 'setup.py from C:\Python26\Tools\Scripts path and run C:\Python26\Python.exe setup.py install) but no use still its coming same error.
SKSK