[Zope] coercing to Unicode: need string or buffer, NoneType found

Dennis Allison allison at shasta.stanford.edu
Tue Apr 25 10:29:34 EDT 2006


Zoe 2.9.0, Python 2.4.2

## Script (Python) "ascript"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
root = container.restrictedTraverse('/')
objs = root.ZopeFind(container.this(), obj_metatypes=['External Method'], 
search_sub=1)
for path, method in objs:
   method.reloadIfChanged()
   print method.title, path
return printed

ERROR:

Exception Type  	TypeError
Exception Value 	coercing to Unicode: need string or buffer, 
NoneType found

Traceback (innermost last):

    * Module ZPublisher.Publish, line 113, in publish
    * Module ZPublisher.mapply, line 88, in mapply
    * Module ZPublisher.Publish, line 40, in call_object
    * Module Shared.DC.Scripts.Bindings, line 311, in __call__
    * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
    * Module Products.PythonScripts.PythonScript, line 323, in _exec
    * Module None, line 4, in ascript
      <PythonScript at /draPlay/ascript>
      Line 4
    * Module Products.ExternalMethod.ExternalMethod, line 154, in 
reloadIfChanged

TypeError: coercing to Unicode: need string or buffer, NoneType found

>From ExternalMethod.py:

152:    def reloadIfChanged(self):
       # If the file has been modified since last loaded, force a reload.
==>    ts=os.stat(self.filepath())[stat.ST_MTIME]
            if (not hasattr(self, '_v_last_read') or
            (ts != self._v_last_read)):
            self._v_f=self.getFunction(1)
            self._v_last_read=ts


Any idea what is causing this error.  Looks to me to be a Python Bug.  A 
bit of Googling shows this error showing up in a number of different 
contexts.  Any suggestions for a workaround?





More information about the Zope mailing list