why cant i import types ?
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
On Thu, 2003-08-14 at 19:34, Declan Shanaghy wrote:
Can someone tell me why i cant import types into my python script in CMF?
You can only import modules that are explicitly permitted. See the README file in the PythonScripts product directory for info. But there's rarely any value to importing the types module anyway. If you want to know if something is a list, you can usually just test to see if it has the characteristics of a list, eg: if hasattr(my_obj, 'sort'): Or you really must know, you can check this way: if type(my_obj) == type([]): HTH, Dylan
participants (2)
-
Declan Shanaghy -
Dylan Reinhardt