amara and django
Question: Hello I am trying to do webservice calls with django views using Amara
library.

However anytime I do `import amara` (by simply importing it!) and call a
django view with it imported, I get such errors:

    
    
    Environment:
    
    Request Method: GET
    Request URL: http://127.0.0.1:4444/test
    Django Version: 1.2.1
    Python Version: 2.6.5
    Installed Applications:
    ['django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.admin',
     'azula.epgdb',
     'django_extensions']
    Installed Middleware:
    ('django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware')
    
    
    Traceback:
    File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
      80.                     response = middleware_method(request)
    File "/usr/local/lib/python2.6/dist-packages/django/middleware/common.py" in process_request
      58.                     _is_valid_path("%s/" % request.path_info, urlconf)):
    File "/usr/local/lib/python2.6/dist-packages/django/middleware/common.py" in _is_valid_path
      143.         urlresolvers.resolve(path, urlconf)
    File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
      301.     return get_resolver(urlconf).resolve(path)
    File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
      216.                     sub_match = pattern.resolve(new_path)
    File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in resolve
      123.             return self.callback, args, kwargs
    File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in _get_callback
      129.             self._callback = get_callable(self._callback_str)
    File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py" in wrapper
      124.         result = func(*args)
    File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in get_callable
      56.                 lookup_view = getattr(import_module(mod_name), func_name)
    File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py" in import_module
      35.     __import__(name)
    File "/home/uluc/azula/epgdb/views.py" in <module>
      4. from azula.epgdb.utils import EventSet
    File "/home/uluc/azula/epgdb/utils.py" in <module>
      6. import amara
    File "/usr/lib/pymodules/python2.6/amara/__init__.py" in <module>
      11. import binderytools
    File "/usr/lib/pymodules/python2.6/amara/binderytools.py" in <module>
      13. from Ft.Xml import InputSource
    File "/usr/lib/python2.6/dist-packages/Ft/Xml/InputSource.py" in <module>
      355. DefaultFactory = InputSourceFactory(catalog=GetDefaultCatalog())
    File "/usr/lib/python2.6/dist-packages/Ft/Xml/Catalog.py" in GetDefaultCatalog
      579.                 catalog = Catalog(uri, quiet)
    File "/usr/lib/python2.6/dist-packages/Ft/Xml/Catalog.py" in __init__
      95.             self._parseXmlCat(data)
    File "/usr/lib/python2.6/dist-packages/Ft/Xml/Catalog.py" in _parseXmlCat
      372.         from Ft.Xml.Sax import CreateParser
    File "/usr/lib/python2.6/dist-packages/Ft/Xml/Sax.py" in <module>
      242. class SaxPrinter(ContentHandler):
    File "/usr/lib/python2.6/dist-packages/Ft/Xml/Sax.py" in SaxPrinter
      247.     def __init__(self, printer=XmlPrinter(sys.stdout, 'utf-8')):
    File "/usr/lib/python2.6/dist-packages/Ft/Xml/Lib/XmlPrinter.py" in __init__
      39.         self.stream = sw = cStreamWriter.StreamWriter(stream, encoding)
    
    Exception Type: TypeError at /test
    Exception Value: argument must have 'write' attribute
    

How can this be solved ? I tried this under either Debian Lenny & Ubuntu 10.04
yet via Django SVN version and Amara 1

I am suspicious of some character encoding problem.


Answer: Putting "WSGIRestrictStdout Off" to my apache fixed the issue as said in
[here](http://forum.springsource.org/showpost.php?p=225788&postcount=3).

