Are you sure that self.getfilepath() is a string?

[EMAIL PROTECTED]:~ $ python
Python 2.4.3 (#2, Apr 10 2006, 11:53:13)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.stat(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: coercing to Unicode: need string or buffer, NoneType found



Dennis Allison wrote:
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?



_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to