[Zope] import * confusion in external methods
Chui Tey
Chui.Tey@env.qld.gov.au
Mon, 27 Sep 1999 17:58:20 +1000
After installing mxODBC and mxDateTime in Zope/lib/odbc and
Zope/lib/DateTime, I tried to do this from the
monitor_client_win32.py:
>>>import ODBC
>>>c = ODBC.Windows.Connect('dsn','Admin','')
------
1999-09-27T07:51:48 PROBLEM(100) ZServer
exceptions.AttributeError Connect [C:\Program
Files\WebGalah\ZServer\medusa\monitor.py|found_terminator|119]
[<secure_monitor_channel connected 127.0.0.1:1764 at b148f0>|?|1]
Traceback (innermost last):
File "C:\Program Files\WebGalah\ZServer\medusa\monitor.py",
line 119, in found _terminator
exec co in self.local_env
File "<secure_monitor_channel connected 127.0.0.1:1764 at b148f0>",
line 1, in ?
AttributeError: Connect
Looking at the attributes of ODBC.Windows reveals :
>>> dir (ODBC.Windows)
------
1999-09-27T07:54:29 INFO(0) ZServer ['__builtins__', '__doc__',
'__file__', '__n
ame__', '__path__']
['__builtins__', '__doc__', '__file__', '__name__', '__path__']
Running dir() on a Python interpreter, the Connect method is visible.
>>> dir (ODBC.Windows)
['BIGINT', 'BINARY', 'BIND_USING_PYTHONTYPE', 'BIND_USING_SQLTYPE',
'BIT', 'CHAR', 'Connect', 'DATE', 'DATETIME_DATETIMEFORMAT', 'DECIMAL',
'DOUBLE', 'DataError', 'DatabaseError', 'DriverConnect', 'Error',
'FLOAT', 'INTEGER', 'IntegrityError', 'InterfaceError', 'InternalError',
'LONGVARBINARY', 'LONGVARCHAR', 'NUMERIC', 'NotSupportedError',
'OperationalError', 'ProgrammingError', 'REAL', 'SMALLINT', 'SQL',
'STRING_DATETIMEFORMAT', 'TIME', 'TIMESTAMP',
'TIMEVALUE_DATETIMEFORMAT', 'TINYINT', 'TUPLE_DATETIMEFORMAT',
'VARBINARY', 'VARCHAR', 'Warning', '__builtins__', '__doc__',
'__file__', '__name__', '__path__', '__version__', 'apilevel',
'connect', 'error', 'errorclass', 'mxODBC', 'mxODBCType',
'mxODBCursorType', 'paramstyle', 'sqltype', 'threadlevel']
What is happening here? Why does Zope hide some of the module's
attributes?