[Zope-dev] why cant i import types

paolo paolomail at noze.it
Sat Aug 16 00:40:09 EDT 2003


Add a folder called GlobalModules in your Products directory and put in
that folder a file called '__init__.py' with this content:

----
from Products.PythonScripts.Utility import allow_module
allow_module('types')
----

with this you can't use "from types import *" but you can use the second
form "from types import ListType, StringType, ..."



Il ven, 2003-08-15 alle 04:18, Declan Shanaghy ha scritto:
> Can someone tell me why i cant import types into my python
> script in CMF?
> When i put either of the following lines as the first line
> of my script i get the error that follows
> 
> from types import * - produces
> Error Type: ImportError
> Error Value: "from types import *" is not allowed
> 
> from types import ListType - produces
> Error Type: ImportError
> Error Value: import of "ListType" from "types" is
> unauthorized. You are not allowed to access ListType in
> this context
> 
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )
-- 
paolo <paolomail at noze.it>
Noze srl




More information about the Zope-Dev mailing list