fgallina / python-django.el

An Emacs package for managing Django projects.
GNU General Public License v3.0
67 stars 24 forks source link

python-django-open-project breaks if settings.py writes to stdout or stderr #2

Closed rerb closed 11 years ago

rerb commented 11 years ago

The json-read-from-string in python-django-info-get-version fails if settings.py writes to stdout or stderr. Maybe very uncommon to have settings print, but one of the ones here does. :-(

There's probably an elegant solution, but my tired mind can't see it now. Redirect sys.stdout and sys.stderr to os.devnull before importing settings, then reset them after? That's the only thing I've come up with, other than hacking the print statements out of the troublesome settings.py -- which won't help the next poor soul who can't figure out why python-django-open-project isn't working.

euanlau commented 11 years ago

I believe I ran into a similar problem. My setting file involves a few import statements and it seems like the python-django-open-project does not handle those statement properly.

An error occurred retrieving project information. Check your project settings and try again:

Error: JSON readtable error