Saturday, August 4, 2012

Re: The rdbms API is not available because the MySQLdb library could not be loaded.

Hello Everyone,

I am new programmer to Python world coming form Java background. Even before starting application development I am stuck with just configuring Django-GAE.

I am using Mac OS X Lion and it has been updated to python 2.7. Secondly I am using PyCharm which make my work easy for configuring Django with GAE. But I am stuck with this stupid error for such a long time that I dont know how to recover from it. Please see the stack trace--

<class 'django.core.exceptions.ImproperlyConfigured'>: Error loading MySQLdb module: No module named MySQLdb 
      args = ('Error loading MySQLdb module: No module named MySQLdb',) 
      message = 'Error loading MySQLdb module: No module named MySQLdb'

________________________ ALSO THIS STACK FROM PyCharm _________________________

Warning: You are using a Python runtime (2.7) that is more recent than the production runtime environment (2.5). Your application may use features that are not available in the production environment and may not work correctly when deployed to production.
INFO     2012-08-04 07:23:49,855 appengine_rpc.py:159] Server: appengine.google.com
INFO     2012-08-04 07:23:49,860 appcfg.py:463] Checking for updates to the SDK.
WARNING  2012-08-04 07:23:50,149 datastore_file_stub.py:512] Could not read datastore data from /var/folders/f1/4tms73816nv959jqkh9wjnqh0000gn/T/dev_appserver.datastore
INFO     2012-08-04 07:23:50,151 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/var/folders/f1/4tms73816nv959jqkh9wjnqh0000gn/T/dev_appserver.rdbms'
WARNING  2012-08-04 07:23:50,274 dev_appserver.py:4648] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO     2012-08-04 07:23:50,290 dev_appserver_multiprocess.py:637] Running application anuj-acharya on port 8080: http://localhost:8080
WARNING  2012-08-04 07:23:56,812 py_zipimport.py:139] Can't open zipfile /Library/Python/2.7/site-packages/oauth2-1.5.170-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/oauth2-1.5.170-py2.7.egg'
WARNING  2012-08-04 07:23:56,813 py_zipimport.py:139] Can't open zipfile /Library/Python/2.7/site-packages/prettytable-0.5-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/prettytable-0.5-py2.7.egg'
WARNING  2012-08-04 07:23:56,813 py_zipimport.py:139] Can't open zipfile /Library/Python/2.7/site-packages/cluster-1.1.1b3-py2.7.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/cluster-1.1.1b3-py2.7.egg'
WARNING  2012-08-04 07:23:56,814 py_zipimport.py:139] Can't open zipfile /Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg: IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg'
ERROR    2012-08-04 07:23:57,357 dev_appserver.py:4096] Exception encountered handling request
Traceback (most recent call last):
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 4039, in _HandleRequest
    self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3945, in _Dispatch
    base_env_dict=env_dict)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 605, in Dispatch
    base_env_dict=base_env_dict)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3015, in Dispatch
    self._module_dict)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2925, in ExecuteCGI
    reset_modules = exec_script(handler_path, cgi_path, hook)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2785, in ExecuteOrImportScript
    exec module_code in script_module.__dict__
  File "/Users/anujacharya1/PycharmProjects/anujsite/main.py", line 16, in <module>
    import django.db
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1426, in Decorate
    return func(self, *args, **kwargs)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2401, in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1426, in Decorate
    return func(self, *args, **kwargs)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2273, in FindAndLoadModule
    description)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1426, in Decorate
    return func(self, *args, **kwargs)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2216, in LoadModuleRestricted
    description)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_2/django/db/__init__.py", line 77, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_2/django/db/utils.py", line 92, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_2/django/db/utils.py", line 33, in load_backend
    return import_module('.base', backend_name)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_2/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1426, in Decorate
    return func(self, *args, **kwargs)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2401, in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1426, in Decorate
    return func(self, *args, **kwargs)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2273, in FindAndLoadModule
    description)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1426, in Decorate
    return func(self, *args, **kwargs)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2216, in LoadModuleRestricted
    description)
  File "/Users/anujacharya1/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_2/django/db/backends/mysql/base.py", line 14, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
INFO     2012-08-04 07:23:57,361 dev_appserver.py:4143] "GET / HTTP/1.1" 500 -
ERROR    2012-08-04 07:23:58,035 dev_appserver.py:3253] Error encountered reading file "/Users/anujacharya1/PycharmProjects/anujsite/favicon.ico":
[Errno 2] No such file or directory: '/Users/anujacharya1/PycharmProjects/anujsite/favicon.ico'
INFO     2012-08-04 07:23:58,045 dev_appserver.py:4143] "GET /favicon.ico HTTP/1.1" 404 -








On Wednesday, November 30, 2011 1:15:36 PM UTC-8, Philip wrote:
I have installed MySQL and the necessary support libraries / files
locally. It is accessible from MySQLWorkbench, Squirrel, and the
Python 2.7 command line (i.e. import MySQLdb succeeds without any
errors). I added the following line to my ./bash_profile file too:

export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"

When I try to start dev_appserver in Eclipse or from a command line
using:

dev_appserver.py --debug --mysql_user=root myapp

I get the following warning and error:

WARNING  2011-11-30 21:07:54,891 rdbms_mysqldb.py:90] The rdbms API is
not available because the MySQLdb library could not be loaded.

ERROR    2011-11-30 21:08:19,042 dev_appserver_main.py:632] <type
'exceptions.NotImplementedError'>: Unable to find the MySQLdb library.
Please see the SDK documentation for installation instructions.

DEBUG    2011-11-30 21:08:19,046 dev_appserver_main.py:634] Traceback
(most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/dev_appserver_main.py", line 629, in main
    dev_appserver.SetupStubs(appinfo.application, **option_dict)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/tools/dev_appserver.py", line 3183, in SetupStubs
    rdbms_mysqldb.connect(database='')
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/api/rdbms_mysqldb.py", line 96, in connect
    'Unable to find the MySQLdb library. Please see the SDK '

I have tried the hack of adding "import MySQLdb" to the
dev_appserver.py file, but that didn't help.

Any ideas?

No comments:

Post a Comment