[Zope-CMF] FSPythonScript outside CMF and outside skins tool

Itai Tavor itai@iinet.net.au
Fri, 6 Dec 2002 17:24:02 +1100


Hi,

I'm trying to use the FSPythonScript module from CMFCore to add a 
filesystem script to a folder. I'm not using the CMF or the Skins Tool.

I'm doing something like this:

         _prefix = package_home(globals())
         ob_id = 'test'
         fname = 'test'
         fp = path.join(_prefix, 'scripts', fname+'.py')
         ob = FSPythonScript(ob_id, fp)
         setattr(self, ob_id, ob)

And I get a 'cannot pickle code objects' error (traceback below) when I 
try to call the added object (which, BTW, contains only return 
'hello'). Why? Can I fix this somehow?

TIA
Itai


Traceback (innermost last):
   File /usr/local/zope/2.5.1/lib/python/ZPublisher/Publish.py, line 
150, in publish_module
   File /usr/local/zope/2.5.1/lib/python/ZPublisher/Publish.py, line 
114, in publish
   File /usr/local/zope/2.5.1/lib/python/Zope/__init__.py, line 159, in 
zpublisher_exception_hook
     (Object: ILARoster)
   File /usr/local/zope/2.5.1/lib/python/ZPublisher/Publish.py, line 
102, in publish
   File /usr/local/zope/2.5.1/lib/python/Zope/__init__.py, line 173, in 
commit
   File /Users/itai/z/2.5/Products/TransactionAgents/__init__.py, line 
54, in new_commit
   File /usr/local/zope/2.5.1/lib/python/ZODB/Transaction.py, line 234, 
in commit
   File /usr/local/zope/2.5.1/lib/python/ZODB/Connection.py, line 346, 
in commit
     (Info: (('Products.CMFCore.FSPythonScript', 'FSPythonScript'), 
'\x00\x00\x00\x00\x00\x01\xf7I', ''))
UnpickleableError: Cannot pickle <type 'code'> objects