Django on Mac OS X

489 views
Skip to first unread message

Daniel França

unread,
Jul 18, 2010, 8:06:58 PM7/18/10
to django...@googlegroups.com
Recently I migrated from Linux to Mac OS X 10.6, and I was thinking that would be easy to migrate my Django project to that.
I was wrong, a lot wrong...
First I tried to install Python2.7, the libs I need to my project, etc
After that I get the error:
gresql_psycopg2/base.py", line 24, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so

After some research I saw some suggestions, one of them was to download and install everything from Ports. But it didn't work for me too:

:info:configure configure: error: library 'xml2' (version >= 2.6.23) is required for XML support
:info:configure shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_postgresql84/work/postgresql-8.4.4" && ./configure --prefix=/opt/local --disable-dependency-tracking --sysconfdir=/opt/local/etc/postgresql84 --bindir=/opt/local/lib/postgresql84/bin --libdir=/opt/local/lib/postgresql84 --includedir=/opt/local/include/postgresql84 --datadir=/opt/local/share/postgresql84 --mandir=/opt/local/share/man --without-docdir --with-includes=/opt/local/include --with-libraries=/opt/local/lib --with-openssl --with-bonjour --with-readline --with-zlib --with-libxml --with-libxslt --enable-thread-safety --enable-integer-datetimes --with-ossp-uuid " returned error 1
:error:configure Target org.macports.configure returned: configure failure: shell command failed

But libxml2.7 was there, what I did? I tried to remove it and install again, but when I tried to reinstall it I get another error:

Error: You cannot install libxml2 for the architecture(s) x86_64 i386 because

Error: its dependency libiconv only contains the architecture(s) i386 ppc.

I tried install psycopg2 using easy_install... everything looks fine, but when I try to run my project, same error before.

Another suggestion I found was to run python in 32 bits mode.

I did a little test:

 "arch -i386 pyhon -c 'import psycopg2' 

It seems to work, but when I ran my project the error is still there, tried to change de env variable:

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

no success yet.

So I gave up of Python2.7 and back to Python2.5 tried to install everything again.

and it's not even recognize Django:

Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    from django.conf import settings
ImportError: No module named django.conf

The libs are here:
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages

ls /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
Django-1.2.1-py2.5.egg-info django_extensions-0.5-py2.5.egg-info psycopg2
PIL django_pagination-1.0.7-py2.5.egg psycopg2-2.2.2-py2.5.egg-info
PIL.pth django_robots-0.8.0-py2.5.egg pytz-2010h-py2.5.egg
South-0.7.1-py2.5.egg django_tagging-0.3.1-py2.5.egg-info setuptools-0.6c11-py2.5.egg
django django_timezones-0.1.4-py2.5.egg setuptools.pth
django_db_log-2.0.0-py2.5.egg easy-install.pth tagging
django_dbtemplates-0.7.1-py2.5.egg include_server
django_extensions include_server-3.1_toolwhip.1-py2.5.egg-info

python --version
Python 2.5.4

Best Regards,

Daniel França




Shawn Milochik

unread,
Jul 18, 2010, 10:10:45 PM7/18/10
to django...@googlegroups.com
This is a known (and common) problem. Here's an easy fix that I've used many times.

http://shawnmilo.blogspot.com/2009/11/psycopg2-on-snow-leopard.html

Incidentally, you can replace "make install" with "make altinstall" to add Python 2.7 to your system without replacing the default Python.

Shawn

Daniel França

unread,
Jul 19, 2010, 12:07:21 AM7/19/10
to django...@googlegroups.com
thanks a lot, now it's working.. at least this part.
=)


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


Daniel França

unread,
Aug 6, 2010, 10:13:40 AM8/6/10
to Shawn Milochik, django...@googlegroups.com
Hi, I'm still get error trying to run my project on Mac =(
Now the standalone server is running fine, but when I try to create a new user I get the error: "Can't adapt type 'US/Eastern", I tried to change my TIME_ZONE in setting, but no success.
I can simulate this error in console, and here's the output:

>>> from django.contrib.auth.models import User
>>> new_user = User.objects.create_user("daniel", "daniel...@gmail.com", "daniel")
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", line 129, in create_user
    user.save(using=self._db)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 435, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 543, in save_base
    created=(not record_exists), raw=raw)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 162, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/danielfranca/workspace/django/view/tint/apps/account/models.py", line 60, in create_account
    account, created = Account.objects.get_or_create(user=instance)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/manager.py", line 135, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 373, in get_or_create
    obj.save(force_insert=True, using=self.db)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 435, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 528, in save_base
    result = manager._insert(values, return_id=update_pk, using=using)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/manager.py", line 195, in _insert
    return insert_query(self.model, values, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 1479, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 783, in execute_sql
    cursor = super(SQLInsertCompiler, self).execute_sql(None)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 727, in execute_sql
    cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/util.py", line 15, in execute
    return self.cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
DatabaseError: can't adapt type 'US/Eastern'

Anyone have any ideia what it can be?
my python version is 1.2.1


On Mon, Jul 19, 2010 at 9:01 AM, Shawn Milochik <sh...@milochik.com> wrote:
Daniel,

Glad to help. If you're new to the Mac and have questions just let me know.

Shawn

Google Chat: shawn...@gmail.com

2010/7/19 Daniel França <daniel...@gmail.com>

xord...@linovia.com

unread,
Aug 6, 2010, 12:02:03 PM8/6/10
to django...@googlegroups.com
Hi daniel,

I doubt your python version is 1.2.1, maybe it's rather Django version :)
However, the issue django stated looks pretty clear to me. You created a
database with a wrong encoding type.
You should have a look at:
http://docs.djangoproject.com/en/1.2/ref/unicode/

Regards,
Xavier.

On Fri, 6 Aug 2010 11:13:40 -0300, Daniel França <daniel...@gmail.com>
wrote:
> Hi, I'm still get error trying to run my project on Mac =(Now the


> standalone server is running fine, but when I try to create a new user I
> get the error: "Can't adapt type 'US/Eastern", I tried to change my
> TIME_ZONE in setting, but no success. I can simulate this error in
> console, and here's the output:
>>>> from django.contrib.auth.models import User >>> new_user =

> User.objects.create_user("daniel", "daniel...@gmail.com [1]",
> "daniel") Traceback (most recent call last):  File "", line 1, in

> args)DatabaseError: can't adapt type 'US/Eastern'
> Anyone have any ideia what it can be?my python version is 1.2.1


>
> On Mon, Jul 19, 2010 at 9:01 AM, Shawn Milochik wrote:
> Daniel,
> Glad to help. If you're new to the Mac and have questions just let me
> know.
> Shawn

> sh...@milochik.com [3] Google Chat: shawn...@gmail.com [4]
>
> 2010/7/19 Daniel França

> thanks a lot, now it's working.. at least this part.=)
>

> On Sun, Jul 18, 2010 at 11:10 PM, Shawn Milochik wrote:
> This is a known (and common) problem. Here's an easy fix that I've used
> many times.
>

> http://shawnmilo.blogspot.com/2009/11/psycopg2-on-snow-leopard.html [7]


>
> Incidentally, you can replace "make install" with "make altinstall" to
> add Python 2.7 to your system without replacing the default Python.
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.

> To post to this group, send email to django...@googlegroups.com [8].


> To unsubscribe from this group, send email to

> django-users...@googlegroups.com [9].


> For more options, visit this group at

> http://groups.google.com/group/django-users?hl=en [10].


>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com

> [11].


> To unsubscribe from this group, send email to

> django-users...@googlegroups.com [12].


> For more options, visit this group at

> http://groups.google.com/group/django-users?hl=en [13].


>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

> Links:
> ------
> [1] mailto:daniel...@gmail.com
> [2] mailto:sh...@milochik.com
> [3] mailto:sh...@milochik.com
> [4] mailto:shawn...@gmail.com
> [5] mailto:daniel...@gmail.com
> [6] mailto:sh...@milochik.com
> [7] http://shawnmilo.blogspot.com/2009/11/psycopg2-on-snow-leopard.html
> [8] mailto:django...@googlegroups.com
> [9] mailto:django-users%2Bunsu...@googlegroups.com
> [10] http://groups.google.com/group/django-users?hl=en
> [11] mailto:django...@googlegroups.com
> [12] mailto:django-users%2Bunsu...@googlegroups.com
> [13] http://groups.google.com/group/django-users?hl=en

Daniel França

unread,
Aug 6, 2010, 3:49:37 PM8/6/10
to django...@googlegroups.com
ops, sorry. python 2.7 django 1.2.1 =}
thanx, I'll look at this

Daniel França

unread,
Aug 7, 2010, 12:44:58 AM8/7/10
to django...@googlegroups.com
My database is UTF-8, it's fine, doesn't?.
I'm afraid to reinstall everything from ports and start to get a lot 64-32 bits incompatible issues like happened before =/

2010/8/6 Daniel França <daniel...@gmail.com>

Xavier Ordoquy

unread,
Aug 7, 2010, 5:49:53 AM8/7/10
to django...@googlegroups.com

Le 7 août 2010 à 06:44, Daniel França a écrit :

> My database is UTF-8, it's fine, doesn't?.
> I'm afraid to reinstall everything from ports and start to get a lot 64-32 bits incompatible issues like happened before =/

I think that should be fine with a utf-8 DB.
Are you sure your tables are UTF-8 ?
What database are you using ? mysql ? postgres ? I had no issue with both and I have a couple of non pure ascii sites.
However, when I moved to snow leopard, I recompiled mysql/postgres and the python drivers.

Regards,
Xavier.

Daniel França

unread,
Aug 7, 2010, 11:21:04 AM8/7/10
to django...@googlegroups.com
I just created my db using django manage syncdb, I think it should create right.
or how can I see the encode of each tables?
I'm using postgresql 8.4
maybe I'll need reinstall everything =S


--

Xavier Ordoquy

unread,
Aug 7, 2010, 11:46:51 AM8/7/10
to django...@googlegroups.com
I just googled your error and found:
According to the first comment, you might do something wrong with the arguments types.
Unless you give a table description (\d from psql shell) and the model I'm not sure I can help you further.

Regards,
Xavier. 

As the stack seems to have a 

Xavier Ordoquy

unread,
Aug 7, 2010, 11:54:54 AM8/7/10
to django...@googlegroups.com
Sorry, I just woke up form a sleep :)
I notice you get-or-create a user.
However, did you try to call get or create with specifying the arguments ? first_name = "...", and so on ?
Does it still give an error ?

Regards,
Xavier.

Daniel França

unread,
Aug 7, 2010, 12:52:36 PM8/7/10
to django...@googlegroups.com
Same error =/
but now,I don't know why.. it's saving at the db. The error still happens, but the data is in the database

Xavier Ordoquy

unread,
Aug 7, 2010, 1:22:14 PM8/7/10
to django...@googlegroups.com
And what's your Account model ?
I noticed it is in its get_or_create that you get the error.

Regards,
Xavier.

Daniel França

unread,
Aug 7, 2010, 3:34:12 PM8/7/10
to django...@googlegroups.com
Xavier, I think we are almost there :P
because there's a timezone field in my account model:

class Account(models.Model):
    
    user = models.ForeignKey(User, unique=True, verbose_name=_('user'))
        
    timezone = TimeZoneField(_('timezone'))
    language = models.CharField(_('language'), max_length=10, choices=settings.LANGUAGES, default=settings.LANGUAGE_CODE)
    
    def __unicode__(self):
        return self.user.username

I tried to comment the line, but then the create_user abort with an constraint timezone error. 

Daniel França

unread,
Aug 7, 2010, 10:09:23 PM8/7/10
to django...@googlegroups.com
More information.
here:
def create_account(sender, instance=None, **kwargs):
    if instance is None:
        return
    account, created = Account.objects.get_or_create(user=instance)

post_save.connect(create_account, sender=User)

If I comment the post_save.connect, there's no exception =) but, of course the code doesn't do what it should do.

So, I don't know why, but the error is in the connect... maybe because of timezone attribute of user
anyone has any idea? 

2010/8/7 Daniel França <daniel...@gmail.com>

Xavier Ordoquy

unread,
Aug 8, 2010, 3:34:44 AM8/8/10
to django...@googlegroups.com
It won't work by commenting the timezone field since it has been created with a non null constraint on your db.
Have you tried to get_or_create the account with timezone and language set to some value ?

Regards,
Xavier.

Daniel França

unread,
Aug 8, 2010, 10:24:40 PM8/8/10
to django...@googlegroups.com
tried, nothing :(
I'm getting crazy with Mac OS, I think I'll go back to Linux :S

Daniel França

unread,
Aug 8, 2010, 11:32:44 PM8/8/10
to django...@googlegroups.com
I tried to reinstall everything... installing python+postgres from ports
and I get the Symbol not found: _PQbackendPID error again from psycopg.
I guess the best solution is run Ubuntu on a virtual machine or my project will be stuck forever.
python+psycopg on mac just sux.


2010/8/8 Daniel França <daniel...@gmail.com>

Sam Lai

unread,
Aug 9, 2010, 12:27:12 AM8/9/10
to django...@googlegroups.com
2010/8/9 Daniel França <daniel...@gmail.com>:

> I tried to reinstall everything... installing python+postgres from ports
> and I get the Symbol not found: _PQbackendPID error again from psycopg.
> I guess the best solution is run Ubuntu on a virtual machine or my project
> will be stuck forever.
> python+psycopg on mac just sux.

I haven't really been following this thread, but you meant psycopg2,
not psycopg right? psycopg is old and unsupported as far as I know.

Daniel França

unread,
Aug 9, 2010, 5:52:40 AM8/9/10
to django...@googlegroups.com
yeah, psycopg2

Xavier Ordoquy

unread,
Aug 9, 2010, 8:04:26 AM8/9/10
to django...@googlegroups.com
I doubt it's a mac issue.
I already ran in a couple of very painful issues with postgresql on Linux while having no issue with mysql on mac.
My feeling is that postgresql require far more attention than mysql and is more sensitive to small changes.

Regards,
Xavier.

lukaszb

unread,
Aug 9, 2010, 9:20:23 AM8/9/10
to Django users
I haven't read all the comments here but if you've just started
working on osx you should definitely check out http://github.com/mxcl/homebrew
- it's a package manager which works like a charm most of the time.

Installation is extremely simple (there is even one-liner available).
If your problem is related with wrong packages installation - homebrew
would most probably fix all of them, if only you can get rid of those
ports/finks at the first place.

Regards,
Lukasz

On Aug 9, 2:04 pm, Xavier Ordoquy <xordo...@linovia.com> wrote:
> I doubt it's a mac issue.
> I already ran in a couple of very painful issues with postgresql on Linux while having no issue with mysql on mac.
> My feeling is that postgresql require far more attention than mysql and is more sensitive to small changes.
>
> Regards,
> Xavier.
>
> Le 9 août 2010 à 05:32, Daniel França a écrit :
>
>
>
> > I tried to reinstall everything... installing python+postgres from ports
> > and I get the Symbol not found: _PQbackendPID error again from psycopg.
> > I guess the best solution is run Ubuntu on a virtual machine or my project will be stuck forever.
> > python+psycopg on mac just sux.
>
> > 2010/8/8 Daniel França <daniel.fra...@gmail.com>
> > tried, nothing :(
> > I'm getting crazy with Mac OS, I think I'll go back to Linux :S
>
> > On Sun, Aug 8, 2010 at 4:34 AM, Xavier Ordoquy <xordo...@linovia.com> wrote:
> > It won't work by commenting the timezone field since it has been created with a non null constraint on your db.
> > Have you tried to get_or_create the account with timezone and language set to some value ?
>
> > Regards,
> > Xavier.
>
> > Le 8 août 2010 à 04:09, Daniel França a écrit :
>
> >> More information.
> >> here:
> >> def create_account(sender, instance=None, **kwargs):
> >>     if instance is None:
> >>         return
> >>     account, created = Account.objects.get_or_create(user=instance)
>
> >> post_save.connect(create_account, sender=User)
>
> >> If I comment the post_save.connect, there's no exception =) but, of course the code doesn't do what it should do.
>
> >> So, I don't know why, but the error is in the connect... maybe because of timezone attribute of user
> >> anyone has any idea?
>
> >> 2010/8/7 Daniel França <daniel.fra...@gmail.com>
> >> Xavier, I think we are almost there :P
> >> because there's a timezone field in my account model:
>
> >> class Account(models.Model):
>
> >>     user = models.ForeignKey(User, unique=True, verbose_name=_('user'))
>
> >>     timezone = TimeZoneField(_('timezone'))
> >>     language = models.CharField(_('language'), max_length=10, choices=settings.LANGUAGES, default=settings.LANGUAGE_CODE)
>
> >>     def __unicode__(self):
> >>         return self.user.username
>
> >> I tried to comment the line, but then the create_user abort with an constraint timezone error.
>
> >> On Sat, Aug 7, 2010 at 2:22 PM, Xavier Ordoquy <xordo...@linovia.com> wrote:
> >> And what's your Account model ?
> >> I noticed it is in its get_or_create that you get the error.
>
> >> Regards,
> >> Xavier.
>
> >> Le 7 août 2010 à 18:52, Daniel França a écrit :
>
> >>> Same error =/
> >>> but now,I don't know why.. it's saving at the db. The error still happens, but the data is in the database
>
> >>> On Sat, Aug 7, 2010 at 12:54 PM, Xavier Ordoquy <xordo...@linovia.com> wrote:
> >>> Sorry, I just woke up form a sleep :)
> >>> I notice you get-or-create a user.
> >>> However, did you try to call get or create with specifying the arguments ? first_name = "...", and so on ?
> >>> Does it still give an error ?
>
> >>> Regards,
> >>> Xavier.
>
> >>> Le 7 août 2010 à 17:46, Xavier Ordoquy a écrit :
>
> >>>> I just googled your error and found:
> >>>>http://www.nerdydork.com/django-programmingerror-cant-adapt.html
> >>>> According to the first comment, you might do something wrong with the arguments types.
> >>>> Unless you give a table description (\d from psql shell) and the model I'm not sure I can help you further.
>
> >>>> Regards,
> >>>> Xavier.
>
> >>>> As the stack seems to have a
>
> >>>> Le 7 août 2010 à 17:21, Daniel França a écrit :
>
> >>>>> I just created my db using django manage syncdb, I think it should create right.
> >>>>> or how can I see the encode of each tables?
> >>>>> I'm using postgresql 8.4
> >>>>> maybe I'll need reinstall everything =S
>
> >>>>> On Sat, Aug 7, 2010 at 6:49 AM, Xavier Ordoquy <xordo...@linovia.com> wrote:
>
> >>>>> Le 7 août 2010 à 06:44, Daniel França a écrit :
>
> >>>>> > My database is UTF-8, it's fine, doesn't?.
> >>>>> > I'm afraid to reinstall everything from ports and start to get a lot 64-32 bits incompatible issues like happened before =/
>
> >>>>> I think that should be fine with a utf-8 DB.
> >>>>> Are you sure your tables are UTF-8 ?
> >>>>> What database are you using ? mysql ? postgres ? I had no issue with both and I have a couple of non pure ascii sites.
> >>>>> However, when I moved to snow leopard, I recompiled mysql/postgres and the python drivers.
>
> >>>>> Regards,
> >>>>> Xavier.
>
> >>>>> --
> >>>>> You received this message because you are subscribed to the Google Groups "Django users" group.
> >>>>> To post to this group, send email to django...@googlegroups.com.
> >>>>> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> >>>>> For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>
> >>>>> --
> >>>>> You received this message because you are subscribed to the Google Groups "Django users" group.
> >>>>> To post to this group, send email to django...@googlegroups.com.
> >>>>> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> >>>>> For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google Groups "Django users" group.
> >>>> To post to this group, send email to django...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> >>>> For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups "Django users" group.
> >>> To post to this group, send email to django...@googlegroups.com.
> >>> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> >>> For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups "Django users" group.
> >>> To post to this group, send email to django...@googlegroups.com.
> >>> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> >>> For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Django users" group.
> >> To post to this group, send email to django...@googlegroups.com.
> >> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Django users" group.
> >> To post to this group, send email to django...@googlegroups.com.
> >> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Django users" group.
> > To post to this group, send email to django...@googlegroups.com.
> > To unsubscribe from this group, send email to django-users...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

tsmets

unread,
Aug 9, 2010, 9:47:45 AM8/9/10
to Django users
Daniel,

Did you manage to have the application running on sqlite3 ... ?
I develop on Mac & have few issues... so may be you could first ensure
everything is working without postgresql connector ... ?

\T,

On Aug 9, 4:24 am, Daniel França <daniel.fra...@gmail.com> wrote:
> tried, nothing :(
> I'm getting crazy with Mac OS, I think I'll go back to Linux :S
>
> On Sun, Aug 8, 2010 at 4:34 AM, Xavier Ordoquy <xordo...@linovia.com> wrote:
> > It won't work by commenting the timezone field since it has been created
> > with a non null constraint on your db.
> > Have you tried to get_or_create the account with timezone and language set
> > to some value ?
>
> > Regards,
> > Xavier.
>
> > Le 8 août 2010 à 04:09, Daniel França a écrit :
>
> > More information.
> > here:
> > def create_account(sender, instance=None, **kwargs):
> >     if instance is None:
> >         return
> >     account, created = Account.objects.get_or_create(user=instance)
>
> > post_save.connect(create_account, sender=User)
>
> > If I comment the *post_save.connect*, there's no exception =) but, of
> > course the code doesn't do what it should do.
>
> > So, I don't know why, but the error is in the connect... maybe because of
> > timezone attribute of user
> > anyone has any idea?
>
> > 2010/8/7 Daniel França <daniel.fra...@gmail.com>
>
> >> Xavier, I think we are almost there :P
> >> because there's a timezone field in my account model:
>
> >> class Account(models.Model):
>
> >>     user = models.ForeignKey(User, unique=True, verbose_name=_('user'))
>
> >>     timezone = TimeZoneField(_('timezone'))
> >>     language = models.CharField(_('language'), max_length=10,
> >> choices=settings.LANGUAGES, default=settings.LANGUAGE_CODE)
>
> >>     def __unicode__(self):
> >>         return self.user.username
>
> >> I tried to comment the line, but then the create_user abort with an
> >> constraint timezone error.
>
> >> On Sat, Aug 7, 2010 at 2:22 PM, Xavier Ordoquy <xordo...@linovia.com>wrote:
>
> >>> And what's your Account model ?
> >>> I noticed it is in its get_or_create that you get the error.
>
> >>> Regards,
> >>> Xavier.
>
> >>> Le 7 août 2010 à 18:52, Daniel França a écrit :
>
> >>> Same error =/
> >>> but now,I don't know why.. it's saving at the db. The error still
> >>> happens, but the data is in the database
>
> >>> On Sat, Aug 7, 2010 at 12:54 PM, Xavier Ordoquy <xordo...@linovia.com>wrote:
>
> >>>> Sorry, I just woke up form a sleep :)
> >>>> I notice you get-or-create a user.
> >>>> However, did you try to call get or create with specifying the arguments
> >>>> ? first_name = "...", and so on ?
> >>>> Does it still give an error ?
>
> >>>> Regards,
> >>>> Xavier.
>
> >>>> Le 7 août 2010 à 17:46, Xavier Ordoquy a écrit :
>
> >>>> I just googled your error and found:
> >>>>http://www.nerdydork.com/django-programmingerror-cant-adapt.html
> >>>> According to the first comment, you might do something wrong with the
> >>>> arguments types.
> >>>> Unless you give a table description (\d from psql shell) and the model
> >>>> I'm not sure I can help you further.
>
> >>>> Regards,
> >>>> Xavier.
>
> >>>> As the stack seems to have a
>
> >>>> Le 7 août 2010 à 17:21, Daniel França a écrit :
>
> >>>> I just created my db using django manage syncdb, I think it should
> >>>> create right.
> >>>> or how can I see the encode of each tables?
> >>>> I'm using postgresql 8.4
> >>>> maybe I'll need reinstall everything =S
>
> >>>> On Sat, Aug 7, 2010 at 6:49 AM, Xavier Ordoquy <xordo...@linovia.com>wrote:
>
> >>>>> Le 7 août 2010 à 06:44, Daniel França a écrit :
>
> >>>>> > My database is UTF-8, it's fine, doesn't?.
> >>>>> > I'm afraid to reinstall everything from ports and start to get a lot
> >>>>> 64-32 bits incompatible issues like happened before =/
>
> >>>>> I think that should be fine with a utf-8 DB.
> >>>>> Are you sure your tables are UTF-8 ?
> >>>>> What database are you using ? mysql ? postgres ? I had no issue with
> >>>>> both and I have a couple of non pure ascii sites.
> >>>>> However, when I moved to snow leopard, I recompiled mysql/postgres and
> >>>>> the python drivers.
>
> >>>>> Regards,
> >>>>> Xavier.
>
> >>>>> --
> >>>>> You received this message because you are subscribed to the Google
> >>>>> Groups "Django users" group.
> >>>>> To post to this group, send email to django...@googlegroups.com.
> >>>>> To unsubscribe from this group, send email to
> >>>>> django-users...@googlegroups.com<django-users%2Bunsu...@googlegroups.com>
> >>>>> .
> >>>>> For more options, visit this group at
> >>>>>http://groups.google.com/group/django-users?hl=en.
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Django users" group.
> >>>> To post to this group, send email to django...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> django-users...@googlegroups.com.
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/django-users?hl=en.
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Django users" group.
> >>>> To post to this group, send email to django...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> django-users...@googlegroups.com.
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/django-users?hl=en.
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Django users" group.
> >>>> To post to this group, send email to django...@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> django-users...@googlegroups.com<django-users%2Bunsu...@googlegroups.com>
> >>>> .
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/django-users?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Django users" group.
> >>> To post to this group, send email to django...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> django-users...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/django-users?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Django users" group.
> >>> To post to this group, send email to django...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> django-users...@googlegroups.com<django-users%2Bunsu...@googlegroups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users...@googlegroups.com<django-users%2Bunsu...@googlegroups.com>
> > .

Russell Keith-Magee

unread,
Aug 9, 2010, 9:53:16 AM8/9/10
to django...@googlegroups.com
I use PostgreSQL on my Mac as well as MySQL, and I've had many fewer
problems with PostgreSQL than I've had with MySQL.

My personal opinion: Ignore all the ports/fink stuff, and get a good
native PostgreSQL install:

http://postgresqlformac.com

The 8.4.3 installer has some known problems (easy to fix if you know
what they are, but easier to avoid if this is your first time), but
other than that, this is a pretty reliable source of installers and
native tools. Once you've got the database installed, psycopg2
installs from source fairly cleanly.

Yours,
Russ Magee %-)

Daniel França

unread,
Aug 9, 2010, 4:40:31 PM8/9/10
to django...@googlegroups.com
Thanx for all the help,
I tried to run on Sqlite3, and I don't if it's bad or good news, but there's error even in Sqlite3

just when I tried to create the db (syncdb) I get just after I input my users data or when I try to create a user in shell:
Traceback (most recent call last):
  File "manage.py", line 31, in <module>
    execute_from_command_line()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 218, in execute
    output = self.handle(*args, **options)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 347, in handle
    return self.handle_noargs(**options)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 103, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/sql.py", line 185, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 162, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 44, in create_superuser
    call_command("createsuperuser", interactive=True)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 166, in call_command
    return klass.execute(*args, **defaults)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 218, in execute
    output = self.handle(*args, **options)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 134, in handle
    User.objects.create_superuser(username, email, password)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", line 133, in create_superuser
    u = self.create_user(username, email, password)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", line 129, in create_user
    user.save(using=self._db)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 435, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 543, in save_base
    created=(not record_exists), raw=raw)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 162, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/danielfranca/workspace/django/view/tint/apps/account/models.py", line 61, in create_account
    account, created = Account.objects.get_or_create(user=instance,timezone='America/Sao_Paulo')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/manager.py", line 135, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get_or_create
    return self.get(**kwargs), False
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 336, in get
    num = len(clone)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 81, in __len__
    self._result_cache = list(self.iterator())
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 269, in iterator
    for row in compiler.results_iter():
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 672, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 727, in execute_sql
    cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/util.py", line 15, in execute
    return self.cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 200, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.


I don't know if has something todo, but my Mac OSX is is english, and my timezone is São Paulo - Brazil.



Daniel-Francas-MacBook-Pro:tint danielfranca$ python manage.py shell
2.7 (r27:82508, Jul  3 2010, 20:17:05) 
[GCC 4.0.1 (Apple Inc. build 5493)]
Python 2.7 (r27:82508, Jul  3 2010, 20:17:05) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.auth.models import User
>>> new_user = create_user('teste','te...@gmail.com','teste')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'create_user' is not defined
>>> new_user = User.objects.create_user('teste','te...@gmail.com','teste')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", line 129, in create_user
    user.save(using=self._db)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 435, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 543, in save_base
    created=(not record_exists), raw=raw)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 162, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/danielfranca/workspace/django/view/tint/apps/account/models.py", line 61, in create_account
    account, created = Account.objects.get_or_create(user=instance,timezone='America/Sao_Paulo')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/manager.py", line 135, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 366, in get_or_create
    return self.get(**kwargs), False
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 336, in get
    num = len(clone)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 81, in __len__
    self._result_cache = list(self.iterator())
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 269, in iterator
    for row in compiler.results_iter():
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 672, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 727, in execute_sql
    cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/util.py", line 15, in execute
    return self.cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 200, in execute
    return Database.Cursor.execute(self, query, params)
InterfaceError: Error binding parameter 0 - probably unsupported type.

Xavier Ordoquy

unread,
Aug 9, 2010, 7:48:14 PM8/9/10
to django...@googlegroups.com
Please, install django_extentions, werkzeug debuger and try to see what exactly where the issue is with the runserver_plus command (in browser debugger so you'll get the variables that are missing here.
Most probably, your timezone field causes the issue.

Regards,
Xavier.

Daniel França

unread,
Aug 9, 2010, 10:30:30 PM8/9/10
to django...@googlegroups.com
Hi, thanks, I didn't know this werkzeug debuger.
Now I can see exactly where it raises the error and can print the variables values, here's the output with some values:

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 200, in execute


return Database.Cursor.execute(self, query, params)

[console ready]
>>> print params (1, <DstTzInfo 'America/Sao_Paulo' LMT-1 day, 20:54:00 STD>, u'pt-br')
>>> print self <django.db.backends.sqlite3.base.SQLiteCursorWrapper object at 0x1e214e0>
>>> print query INSERT INTO "account_account" ("user_id", "timezone", "language") VALUES (?, ?, ?)
>>> print params[1] America/Sao_Paulo
>>> print params[0] 1
>>> print params[2] pt-br

Any idea?

tsmets

unread,
Aug 10, 2010, 4:33:12 AM8/10/10
to Django users
My feeling is that you are now hitting a bug from your app & not a
django / python / mac / ... issue.
A stupid gess from me ...
You use a Custom Profile for the User and it is an upgrade from Django
1.1 and ... you need to adapt the minor details about it .
If you code is in a SVN server I can do a svn export and test it here
if you want ... if I do have the same problem ... it is yr app :(

\T,
> russ...@keith-magee.com> wrote:
> > I use PostgreSQL on my Mac as well as MySQL, and I've had many fewer
> > problems with PostgreSQL than I've had with MySQL.
>
> > My personal opinion: Ignore all the ports/fink stuff, and get a good
> > native PostgreSQL install:
>
> >http://postgresqlformac.com
>
> > The 8.4.3 installer has some known problems (easy to fix if you know
> > what they are, but easier to avoid if this is your first time), but
> > other than that, this is a pretty reliable source of installers and
> > native tools. Once you've got the database installed, psycopg2
> > installs from source fairly cleanly.
>
> > Yours,
> > Russ Magee %-)
>
> > On 8/9/10, lukaszb <lukaszbalcer...@gmail.com> wrote:
> > > I haven't read all the comments here but if you've just started
> > > working on osx you should definitely check out
>
> ...
>
> read more »

Daniel França

unread,
Aug 10, 2010, 7:08:35 AM8/10/10
to django...@googlegroups.com
My code is based on Pinax: http://pinaxproject.com/
and the Profile comes from there.


--

Daniel França

unread,
Aug 10, 2010, 7:12:25 AM8/10/10
to django...@googlegroups.com
ahh... and my code is in github
if someone wanna test it: http://github.com/danielfranca/Tint

2010/8/10 Daniel França <daniel...@gmail.com>

Xavier Ordoquy

unread,
Aug 10, 2010, 8:10:03 AM8/10/10
to django...@googlegroups.com
It is definitively an issue in your code.

syncdb won't run without complaining about the timezone field in your account model.
Once commented, syncdb continues but at some point will fail because it expects a site to be configured but at this point, the site table is not garanteed to be there...

btw, you also have a couple of hard coded path here and there (the log files for example).

Regards,
Xavier.

Daniel França

unread,
Aug 10, 2010, 8:21:04 AM8/10/10
to django...@googlegroups.com
the log files are for tests purposes only.
I'm inserting the site table myself.

is it a bug in pinax profiles? accounts? I didn't get the point.

Xavier Ordoquy

unread,
Aug 10, 2010, 9:06:23 AM8/10/10
to django...@googlegroups.com
Actually I have pinax (trunk) running with the social template and django 1.2 without issue using sqlite on OSX.
I can change my profile timezone in this application without any issue, everything seems to be working fine.

Somehow, the changes you made seem to have messed up something or you don't use the right pinax/django versions.

Regards,
Xavier.

Daniel França

unread,
Aug 10, 2010, 9:08:14 AM8/10/10
to django...@googlegroups.com
I'll try to update my code.

Daniel França

unread,
Aug 10, 2010, 9:10:36 AM8/10/10
to django...@googlegroups.com
It's very useful Andy, sympathy is welcome =)
I was programming under linux, and I guessed that would be really straight forward port my project to OSX, I was wrong :(


2010/8/10 AndyB <and...@gmail.com>

I haven't got anything useful to add other than some sympathy. I
vented my incoherent rage on Twitter a few months ago over how much
trouble I had getting various Python binaries working. PIL, MySQL-
Python, lxml and a couple more still plague my fevered dreams...

As a web developer I never really wanted to get knee-deep in gcc and
make errors. I would love someone cleverer than myself to make the
experience of getting a fully featured Django install running on OS X
a little more streamlined. Unfortunately the people with the skills to
do so are usually the people without the need and the people who need
one don't have the knowledge to make one. :-(

I know it's not fair to moan when you don't contribute but it's nice
to share the pain sometimes ;-)

(after writing it I decided not to post this to the forum as I'm not
saying anything useful but I thought I'd send it to you anyway!)

regards,

Andy Baker


Xavier Ordoquy

unread,
Aug 10, 2010, 9:35:46 AM8/10/10
to django...@googlegroups.com

Le 10 août 2010 à 15:10, Daniel França a écrit :

It's very useful Andy, sympathy is welcome =)
I was programming under linux, and I guessed that would be really straight forward port my project to OSX, I was wrong :(

You know you are unfair. Unless you have strong evidence, you shouldn't blame osx for mistakes you probably made.
Actually, your code doesn't work at all.
I just gave a try on ubuntu 9.10/Django 1.2/sqlite DB and got the same error as I have on OSX (Error binding parameter 1 - probably unsupported type.).

Regards,
Xavier.

Daniel França

unread,
Aug 10, 2010, 9:42:31 AM8/10/10
to django...@googlegroups.com
I'm not blaming OSX.
I just said that it was working on Linux, and now it's not working on Mac.
and even if my code is wrong that shouldn't be that dificulty to find the error, doesn't agree? A more clear error message would help.
The problem isn't the error, but we are about a month arguing about this error, and I'm sure the error message isn't clear enough.
Maybe it's a silly mistake, but I think I should receive a message that clearly say me that.


--

Xavier Ordoquy

unread,
Aug 10, 2010, 11:05:41 AM8/10/10
to django...@googlegroups.com

Actually, it doesn't work on Linux either with the same settings.
Please update django-timezones to 0.2.dev2 which is what pinax uses (pip install --extra-index-url=http://dist.pinaxproject.com/dev/ django-timezones==0.2.dev1). The latest stable doesn't seem to work with django 1.2.
I bet you installed pinax on your linux box but not on your osx one (or not in the same virtual env).

Regards,
Xavier.

Daniel França

unread,
Aug 10, 2010, 11:12:32 AM8/10/10
to django...@googlegroups.com
I bet you installed pinax on your linux box but not on your osx one (or not in the same virtual env).
hmmm, I just copied the code from Linux to OSX, is it what you mean? I should have "install" Pinax, that's it?

Xavier Ordoquy

unread,
Aug 10, 2010, 11:31:31 AM8/10/10
to django...@googlegroups.com
It is a bit trickier.
Pinax application gets all their dependancies through pip installation and requirement files.
If you have a pinax application, take a look in the requirements directory. You'll find two files (base.txt and project.txt) that tell exactly what application to get and what versions are needed.
Pinax does all the bootstrap processing, so once you installed a pinax application, you already have a working environment.

Your application is based on the same common set with Pinax application. However, if you copied the code, you didn't went thought pinax bootstraping operations which would have installed all the required applications with the correct versions.
It happens that I am unable to make your application work on osx and Linux with the latest stable django-timezones (0.1.x).
However, using the version that Pinax requires (0.2.dev1) it works on both linux and osx.
However, you may find other differences if your environments are different.
Please google for virtualenv and pip to get the same environment on your various development boxes as well as your production ones and enjoy virtualenv, pip, Python, Django, OSX and Linux :)

Regards,
Xavier.

Daniel França

unread,
Aug 10, 2010, 10:50:06 PM8/10/10
to django...@googlegroups.com
thanx, I'll look at that =)

AndrewK

unread,
Aug 21, 2010, 9:55:53 PM8/21/10
to Django users
I've had the same problem on my Mac just now.
It seems like this is an issue with django-timezones

Try to install dev version from here:
pip install -e git://github.com/brosner/django-timezones.git#egg=django-timezones

Andrew

On Aug 9, 1:40 pm, Daniel França <daniel.fra...@gmail.com> wrote:
> Thanx for all the help,
> I tried to run on Sqlite3, and I don't if it's bad or good news, but there's
> error even in Sqlite3
>
> just when I tried to create the db (syncdb) I get just after I input my
> users data or when I try to create a user in shell:
> Traceback (most recent call last):
>   File "manage.py", line 31, in <module>
>     execute_from_command_line()
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/__init__.py",
> line 429, in execute_from_command_line
>     utility.execute()
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/__init__.py",
> line 379, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/base.py",
> line 191, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/base.py",
> line 218, in execute
>     output = self.handle(*args, **options)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/base.py",
> line 347, in handle
>     return self.handle_noargs(**options)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/commands/syncdb.py",
> line 103, in handle_noargs
>     emit_post_sync_signal(created_models, verbosity, interactive, db)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/sql.py",
> line 185, in emit_post_sync_signal
>     interactive=interactive, db=db)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/dispatch/dispatcher.py",
> line 162, in send
>     response = receiver(signal=self, sender=sender, **named)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/contrib/auth/management/__init__.py",
> line 44, in create_superuser
>     call_command("createsuperuser", interactive=True)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/__init__.py",
> line 166, in call_command
>     return klass.execute(*args, **defaults)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/core/management/base.py",
> line 218, in execute
>     output = self.handle(*args, **options)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/contrib/auth/management/commands/createsuperuser.py",
> line 134, in handle
>     User.objects.create_superuser(username, email, password)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/contrib/auth/models.py",
> line 133, in create_superuser
>     u = self.create_user(username, email, password)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/contrib/auth/models.py",
> line 129, in create_user
>     user.save(using=self._db)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/base.py",
> line 435, in save
>     self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/base.py",
> line 543, in save_base
>     created=(not record_exists), raw=raw)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/dispatch/dispatcher.py",
> line 162, in send
>     response = receiver(signal=self, sender=sender, **named)
>   File
> "/Users/danielfranca/workspace/django/view/tint/apps/account/models.py",
> line 61, in create_account
>     account, created =
> Account.objects.get_or_create(user=instance,timezone='America/Sao_Paulo')
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/manager.py",
> line 135, in get_or_create
>     return self.get_query_set().get_or_create(**kwargs)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/query.py",
> line 366, in get_or_create
>     return self.get(**kwargs), False
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/query.py",
> line 336, in get
>     num = len(clone)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/query.py",
> line 81, in __len__
>     self._result_cache = list(self.iterator())
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/query.py",
> line 269, in iterator
>     for row in compiler.results_iter():
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/sql/compiler.py",
> line 672, in results_iter
>     for rows in self.execute_sql(MULTI):
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/sql/compiler.py",
> line 727, in execute_sql
>     cursor.execute(sql, params)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/backends/util.py",
> line 15, in execute
>     return self.cursor.execute(sql, params)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/backends/sqlite3/base.py",
> line 200, in execute
>     return Database.Cursor.execute(self, query, params)
> sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported
> type.
>
> I don't know if has something todo, but my Mac OSX is is english, and my
> timezone is São Paulo - Brazil.
>
> Daniel-Francas-MacBook-Pro:tint danielfranca$ python manage.py shell
> 2.7 (r27:82508, Jul  3 2010, 20:17:05)
> [GCC 4.0.1 (Apple Inc. build 5493)]
> Python 2.7 (r27:82508, Jul  3 2010, 20:17:05)
> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)>>> from django.contrib.auth.models import User
> >>> new_user = create_user('teste','te...@gmail.com','teste')
>
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
> NameError: name 'create_user' is not defined>>> new_user = User.objects.create_user('teste','te...@gmail.com','teste')
>
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/contrib/auth/models.py",
> line 129, in create_user
>     user.save(using=self._db)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/base.py",
> line 435, in save
>     self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/base.py",
> line 543, in save_base
>     created=(not record_exists), raw=raw)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/dispatch/dispatcher.py",
> line 162, in send
>     response = receiver(signal=self, sender=sender, **named)
>   File
> "/Users/danielfranca/workspace/django/view/tint/apps/account/models.py",
> line 61, in create_account
>     account, created =
> Account.objects.get_or_create(user=instance,timezone='America/Sao_Paulo')
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/manager.py",
> line 135, in get_or_create
>     return self.get_query_set().get_or_create(**kwargs)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/query.py",
> line 366, in get_or_create
>     return self.get(**kwargs), False
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/query.py",
> line 336, in get
>     num = len(clone)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/query.py",
> line 81, in __len__
>     self._result_cache = list(self.iterator())
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/query.py",
> line 269, in iterator
>     for row in compiler.results_iter():
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/sql/compiler.py",
> line 672, in results_iter
>     for rows in self.execute_sql(MULTI):
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/models/sql/compiler.py",
> line 727, in execute_sql
>     cursor.execute(sql, params)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/backends/util.py",
> line 15, in execute
>     return self.cursor.execute(sql, params)
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa ges/django/db/backends/sqlite3/base.py",
> line 200, in execute
>     return Database.Cursor.execute(self, query, params)
> InterfaceError: Error binding parameter 0 - probably unsupported type.
>
> On Mon, Aug 9, 2010 at 10:53 AM, Russell Keith-Magee <
>
>
>
> russ...@keith-magee.com> wrote:
> > I use PostgreSQL on my Mac as well as MySQL, and I've had many fewer
> > problems with PostgreSQL than I've had with MySQL.
>
> > My personal opinion: Ignore all the ports/fink stuff, and get a good
> > native PostgreSQL install:
>
> >http://postgresqlformac.com
>
> > The 8.4.3 installer has some known problems (easy to fix if you know
> > what they are, but easier to avoid if this is your first time), but
> > other than that, this is a pretty reliable source of installers and
> > native tools. Once you've got the database installed, psycopg2
> > installs from source fairly cleanly.
>
> > Yours,
> > Russ Magee %-)
>
> > On 8/9/10, lukaszb <lukaszbalcer...@gmail.com> wrote:
> > > I haven't read all the comments here but if you've just started
> > > working on osx you should definitely check out
>
> ...
>
> read more »

Daniel França

unread,
Aug 22, 2010, 10:47:19 PM8/22/10
to django...@googlegroups.com
thanks Andrew,
Now I've installed Pinax into a Virtualenv and it's working fine...I installed only the libs versions that Pinax script install.


--

Kurtis Mullins

unread,
Jun 17, 2012, 12:21:38 AM6/17/12
to django...@googlegroups.com
Try using the Brew (or ports or whatever it's called on Mac) system to install Python, PostgreSQL, and the postgresql development libs.

On Sat, Jun 16, 2012 at 11:22 PM, Moshe Voloshin <mosh...@gmail.com> wrote:
Replying to this old post as I am having this problem of:
Symbol not found: _PQbackendPID
On MAC OS x 10.6.8
using:
python 2.7 and postgres 9.1.4
On virtual env
Wanted to ask if you guys seen this issue with python 2.7 and do you know if there is a solution to this.

Thanks

On Sunday, July 18, 2010 5:06:58 PM UTC-7, daniel.franca wrote:
Recently I migrated from Linux to Mac OS X 10.6, and I was thinking that would be easy to migrate my Django project to that.
I was wrong, a lot wrong...
First I tried to install Python2.7, the libs I need to my project, etc
After that I get the error:
gresql_psycopg2/base.py", line 24, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so

After some research I saw some suggestions, one of them was to download and install everything from Ports. But it didn't work for me too:

:info:configure configure: error: library 'xml2' (version >= 2.6.23) is required for XML support
:info:configure shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_postgresql84/work/postgresql-8.4.4" && ./configure --prefix=/opt/local --disable-dependency-tracking --sysconfdir=/opt/local/etc/postgresql84 --bindir=/opt/local/lib/postgresql84/bin --libdir=/opt/local/lib/postgresql84 --includedir=/opt/local/include/postgresql84 --datadir=/opt/local/share/postgresql84 --mandir=/opt/local/share/man --without-docdir --with-includes=/opt/local/include --with-libraries=/opt/local/lib --with-openssl --with-bonjour --with-readline --with-zlib --with-libxml --with-libxslt --enable-thread-safety --enable-integer-datetimes --with-ossp-uuid " returned error 1
:error:configure Target org.macports.configure returned: configure failure: shell command failed

But libxml2.7 was there, what I did? I tried to remove it and install again, but when I tried to reinstall it I get another error:

Error: You cannot install libxml2 for the architecture(s) x86_64 i386 because

Error: its dependency libiconv only contains the architecture(s) i386 ppc.

I tried install psycopg2 using easy_install... everything looks fine, but when I try to run my project, same error before.

Another suggestion I found was to run python in 32 bits mode.

I did a little test:

 "arch -i386 pyhon -c 'import psycopg2' 

It seems to work, but when I ran my project the error is still there, tried to change de env variable:

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

no success yet.

So I gave up of Python2.7 and back to Python2.5 tried to install everything again.

and it's not even recognize Django:

Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    from django.conf import settings
ImportError: No module named django.conf

The libs are here:
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages

ls /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
Django-1.2.1-py2.5.egg-info django_extensions-0.5-py2.5.egg-info psycopg2
PIL django_pagination-1.0.7-py2.5.egg psycopg2-2.2.2-py2.5.egg-info
PIL.pth django_robots-0.8.0-py2.5.egg pytz-2010h-py2.5.egg
South-0.7.1-py2.5.egg django_tagging-0.3.1-py2.5.egg-info setuptools-0.6c11-py2.5.egg
django django_timezones-0.1.4-py2.5.egg setuptools.pth
django_db_log-2.0.0-py2.5.egg easy-install.pth tagging
django_dbtemplates-0.7.1-py2.5.egg include_server
django_extensions include_server-3.1_toolwhip.1-py2.5.egg-info

python --version
Python 2.5.4

Best Regards,

Daniel França




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/opErLpsqs4wJ.

Moshe Voloshin

unread,
Jun 17, 2012, 12:41:17 AM6/17/12
to django...@googlegroups.com
I tried that too, but it didn't change anythin
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.

Thomas Lockhart

unread,
Jun 17, 2012, 2:28:40 AM6/17/12
to django...@googlegroups.com
On 6/16/12 9:41 PM, Moshe Voloshin wrote:
I tried that too, but it didn't change anythin
Tried what too? I've had good luck with python, virtualenv, and postgresql from MacPorts and then using virtualenv and pip to get psycopg2, django, etc.

The library path from your error indicates that you are using the Apple python installation which is not what you would find with MacPorts. You do have /opt/local/bin in your path?

Try for a self-consistent installation and you should stop getting unresolved symbols.

You will likely need to give more details on what you are actually running and where it is installed for someone to give more help.

hth

                           - Tom

Moshe Voloshin

unread,
Jun 17, 2012, 4:04:34 PM6/17/12
to django...@googlegroups.com
Tried homebrew - this was a response to another reply Thomas.

brew update

Here I tried:

brew install postgresql

   but  had this error Error: Failed executing: make install-world (postgresql.rb:67)

So instead I did this:

brew install postgres --no-ossp-uuid  --no-python --no-rubie

Then when running python manage.py runserver I got this error mentioned first:

Symbol not found: _PQbackendPID

In my virtual env I did not install python, it used my mac installation, that is correct.
However from the nature of the error it did not look like it relates to python.
In my settings.py I followed Heroku instructions and put this for the database:
     import dj_database_url
     DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
Here are some details on my virtual env:
That's the structure, without all the files of course:

venv/lib/python2.7/warnings.pyc venv/include/python2.7/unicodeobject.h venv/include/python2.7/metagrammar.h
....

venv/lib/python2.7/site-packages:
setuptools.pth pip-1.1-py2.7.egg dj_database_url.pyc distribute-0.6.24-py2.7.egg
psycopg2-2.4.5-py2.7.egg-info easy-install.pth dj_database_url.py Django-1.4-py2.7.egg-info
psycopg2 django dj_database_url-0.2.0-py2.7.egg-info

venv/lib/python2.7/lib-dynload:
zlib.so fcntl.so _scproxy.so _codecs_jp.so _Help.so
unicodedata.so dl.so _random.so _codecs_iso2022.so .
....

venv/lib/python2.7/encodings:
zlib_codec.pyo shift_jis_2004.pyc mac_croatian.py iso8859_13.pyo gb18030.pyc cp860.py cp1253.pyo
.....

venv/lib/python2.7/distutils:
distutils.cfg __init__.pyc __init__.py

venv/lib/python2.7/config:
python.o libpython2.7.dylib install-sh config.c Setup.config Makefile
makesetup libpython2.7.a config.c.in Setup.local Setup

Not sure if these are the details that can help.
Moshe
Reply all
Reply to author
Forward
0 new messages