kasceled
kasceled

Reputation: 568

Getting 32/64-bit architecture error in Aptana when launching Django project

Like most other Mac/MySQL users with current versions of OS X, I went through the normal issues of getting Python, MySQL and MySQLdb (MySQL-Python) playing nicely together. That has been working for some time, but I'd like to use Aptana for debugging my work Django projects and when I try running either the debugger or running a project, I'm getting the dreaded "mach-o" error.

The interesting thing is that I've configured Aptana to use the same python I'm using (confirmed with a "which python" both within and outside of Aptana), and I've confirmed that the python that's being invoked by Aptana is 32-bit as it should be (same as system terminal reports). Also, when I use the Terminal in Aptana, using the interactive python shell I'm able to successfully 'import MySQLdb'. So I'm stumped.

Under arguments I'm adding this to program arguments per instructions:

runserver 8081 --noreload

But that shouldn't affect anything AFAIK. I'm at a loss of what to do next. Here is the error that Aptana is throwing when I try to launch:

pydev debugger: starting
Validating models...

Traceback (most recent call last):
  File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062515/pysrc/pydevd.py", line 1392, in <module>
    debugger.run(setup['file'], None, None)
  File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062515/pysrc/pydevd.py", line 1085, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "/Users/my/path/project/manage.py", line 14, in <module>
    execute_manager(settings)
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 67, in handle
    self.run(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 78, in run
    self.inner_run(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 249, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
    from django.db import models, connection
  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 33, in load_backend
    return import_module('.base', backend_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): no suitable image found.  Did find:
    /Library/Python/2.7/site-packages/_mysql.so: mach-o, but wrong architecture

Any ideas?

Upvotes: 0

Views: 680

Answers (1)

Fabio Zadrozny
Fabio Zadrozny

Reputation: 25332

Take a look at: How do I force Python to be 32-bit on Snow Leopard and other 32-bit/64-bit questions on ways to configure Python to run in 32 bits (VERSIONER_PYTHON_PREFER_32_BIT environment variable seems a good choice).

Or maybe: Troubles with PyDev and external libraries in OS X

Upvotes: 1

Related Questions