On Nov 21, 2010, at 6:02 PM, Karen McNeil wrote:

> Here's the full traceback, along with the code.  This is definitely
> the code I'm testing, and I'm still getting the same error. The only
> change from what I posted before is that I changed the variable name
> like you suggested.  (I'm also going to change the filenaming scheme,
> but I haven't decided how yet, so right now I just want to get the
> upload working.  The other suggestion you made, about the validators,
> is something I don't know how to do yet.)
> 
> Thank you very much for your help,
> Karen
> 
> ------------------------------------------------------------------------------------------------------------------------------------------------
> TRACEBACK
> ------------------------------------------------------------------------------------------------------------------------------------------------
> 
> URL: http://localhost:8080/add
> Module weberror.evalexception:431 in respond         view
> <<          try:
>                   __traceback_supplement__ =
> errormiddleware.Supplement, self, environ
>                   app_iter = self.application(environ,
> detect_start_response)
> 
>                   # Don't create a list from a paste.fileapp object
>>> app_iter = self.application(environ, detect_start_response)
> Module tg.configuration:796 in remover         view
> <<          def remover(environ, start_response):
>                   try:
>                       return app(environ, start_response)
>                   finally:
>                       log.debug("Removing DBSession from current
> thread")
>>> return app(environ, start_response)
> Module repoze.tm:19 in __call__         view
> <<              return start_response(status, headers, exc_info)
>               try:
>                   result = self.application(environ,
> save_status_and_headers)
>               except:
>                   self.abort()
>>> result = self.application(environ, save_status_and_headers)
> Module repoze.who.middleware:107 in __call__         view
> <<          wrapper = StartResponseWrapper(start_response)
>               app_iter = app(environ, wrapper.wrap_start_response)
> 
>               # The challenge decider almost(?) always needs
> information from the
>>> app_iter = app(environ, wrapper.wrap_start_response)
> Module tw.core.middleware:43 in __call__         view
> <<      def __call__(self, environ, start_response):
>               return self.wsgi_app(environ, start_response)
> 
>           def wsgi_app(self, environ, start_response):
>>> return self.wsgi_app(environ, start_response)
> Module tw.core.middleware:68 in wsgi_app         view
> <<              else:
>                       # Pass request downstream
>                       resp = req.get_response(self.application)
>                   return resp(environ, start_response)
>               finally:
>>> resp = req.get_response(self.application)
> Module webob.request:937 in get_response         view
> Module webob.request:906 in call_application         view
> Module tw.core.resource_injector:68 in _injector         view
> <<      def _injector(environ, start_response):
>               req = Request(environ)
>               resp = req.get_response(app)
>               content_type = resp.headers.get('Content-Type','text/
> plain').lower()
>               if 'html' in content_type:
>>> resp = req.get_response(app)
> Module webob.request:937 in get_response         view
> Module webob.request:906 in call_application         view
> Module beaker.middleware:81 in __call__         view
> <<
> self.cache_manager)
>               environ[self.environ_key] = self.cache_manager
>               return self.app(environ, start_response)
>>> return self.app(environ, start_response)
> Module beaker.middleware:160 in __call__         view
> <<                          headers.append(('Set-cookie', cookie))
>                   return start_response(status, headers, exc_info)
>               return self.wrap_app(environ, session_start_response)
> 
>           def _get_session(self):
>>> return self.wrap_app(environ, session_start_response)
> Module routes.middleware:130 in __call__         view
> <<                  environ['SCRIPT_NAME'] = environ['SCRIPT_NAME']
> [:-1]
> 
>               response = self.app(environ, start_response)
> 
>               # Wrapped in try as in rare cases the attribute will be
> gone already
>>> response = self.app(environ, start_response)
> Module pylons.wsgiapp:125 in __call__         view
> <<
>               controller = self.resolve(environ, start_response)
>               response = self.dispatch(controller, environ,
> start_response)
> 
>               if 'paste.testing_variables' in environ and
> hasattr(response,
>>> response = self.dispatch(controller, environ, start_response)
> Module pylons.wsgiapp:324 in dispatch         view
> <<          if log_debug:
>                   log.debug("Calling controller class with WSGI
> interface")
>               return controller(environ, start_response)
> 
>           def load_test_env(self, environ):
>>> return controller(environ, start_response)
> Module tunisian.lib.base:32 in __call__         view
> <<          request.identity =
> request.environ.get('repoze.who.identity')
>               tmpl_context.identity = request.identity
>               return TGController.__call__(self, environ,
> start_response)
>>> return TGController.__call__(self, environ, start_response)
> Module pylons.controllers.core:221 in __call__         view
> <<                  return response(environ, self.start_response)
> 
>               response = self._dispatch_call()
>               if not start_response_called:
>                   self.start_response = start_response
>>> response = self._dispatch_call()
> Module pylons.controllers.core:172 in _dispatch_call         view
> <<              req.environ['pylons.action_method'] = func
> 
>                   response = self._inspect_call(func)
>               else:
>                   if log_debug:
>>> response = self._inspect_call(func)
> Module pylons.controllers.core:107 in _inspect_call         view
> <<                        func.__name__, args)
>               try:
>                   result = self._perform_call(func, args)
>               except HTTPException, httpe:
>                   if log_debug:
>>> result = self._perform_call(func, args)
> Module tg.controllers.dispatcher:254 in _perform_call         view
> <<          self._setup_wsgi_script_name(url_path, remainder, params)
> 
>               r = self._call(func, params, remainder=remainder)
> 
>               if hasattr(controller, '__after__'):
>>> r = self._call(func, params, remainder=remainder)
> Module tg.controllers.decoratedcontroller:107 in _call         view
> <<              params, remainder =
> self._remove_argspec_params_from_params(controller, params, remainder)
> 
>                   output = controller(*remainder, **dict(params))
> 
>               except formencode.api.Invalid, inv:
>>> output = controller(*remainder, **dict(params))
> Module tunisian.controllers.root:107 in add         view
> <<          #write text file to corpus directory - THIS IS WHERE MY
> PROBLEM IS
>               text_path = os.path.join(corpus_path, filename)
>               f = file(text_path, 'w')
>               f.write(new_file.value)
>               f.close()
>>> f = file(text_path, 'w')
> TypeError: 'unicode' object is not callable

It looks to me that you are shadowing the file-builtin with a string. What 
happens if you use open instead?

Diez

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to