Keith Randall
randallk at cpsc.ucalgary.ca
Sun Nov 23 23:02:04 EST 2003
Hi, I have a script that works fine with mod_python 2.7.8 + apache 1.3.28, and I want to run it under apache 2.0.48 with mod_python 3.1.2b for the session handling stuff. When I try to connect to my postgresql database in the following way: from pyPgSQL import PgSQL pdb = PgSQL.connect( host = 'foo' , port='5432',database='foo',user='joe') Apache error_log says: PythonHandler mod_python.publisher: AttributeError: 'module' object has no attribute 'connect' and indeed when I do a dir(pgSQL), it lists the postgres-python datatypes but no connect function. When I do the same outside apache/mod_python I can see the connect function. Any thoughts? dir(PgSQL) running within mod_python: ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType', 'DateTime', 'DictProxyType', 'DictType', 'DictionaryType', 'EllipsisType', 'FileType', 'FloatType', 'FrameType', 'FunctionType', 'GeneratorType', 'InstanceType', 'IntType', 'LambdaType', 'ListType', 'LongType', 'MethodType', 'ModuleType', 'NoneType', 'NotImplementedType', 'ObjectType', 'SliceType', 'StringType', 'StringTypes', 'TracebackType', 'TupleType', 'TypeType', 'UnboundMethodType', 'UnicodeType', 'XRangeType', '__builtins__', '__doc__', '__file__', '__name__', 'copy', 'getdefaultencoding', 'getrefcount', 'new', 'noWeakRef', 're', 'string', 'sys', 'weakref'] dir(PgSQL) running outside mod_python: ['BAD_RESPONSE', 'BINARY', 'BOOLEAN', 'BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'COMMAND_OK', 'CONNECTION_BAD', 'CONNECTION_OK', 'COPY_IN', 'COPY_OUT', 'ClassType', 'CodeType', 'ComplexType', 'Connection', 'Cursor', 'DATETIME', 'DBAPITypeObject', 'DataError', 'DatabaseError', 'Date', 'DateFromTicks', 'DateTime', 'DateTimeDelta', 'DateTimeDeltaType', 'DateTimeType', 'DictProxyType', 'DictType', 'DictionaryType', 'EMPTY_QUERY', 'EllipsisType', 'Error', 'FATAL_ERROR', 'FileType', 'FloatType', 'FrameType', 'FunctionType', 'GeneratorType', 'HAVE_LONG_LONG_SUPPORT', 'INV_READ', 'INV_SEEK_CUR', 'INV_SEEK_END', 'INV_SEEK_SET', 'INV_WRITE', 'InstanceType', 'IntType', 'IntegrityError', 'InterfaceError', 'InternalError', 'LambdaType', 'ListType', 'LongType', 'MethodType', 'ModuleType', 'NONFATAL_ERROR', 'NUMBER', 'NoneType', 'NotImplementedType', 'NotSupportedError', 'OTHER', 'ObjectType', 'OperationalError', 'PG_ABSTIME', 'PG_ACLITEM', 'PG_BIGINT', 'PG_BLOB', 'PG_BOOL', 'PG_BOX', 'PG_BPCHAR', 'PG_BYTEA', 'PG_CASH', 'PG_CHAR', 'PG_CID', 'PG_CIDR', 'PG_CIRCLE', 'PG_DATE', 'PG_FLOAT', 'PG_FLOAT4', 'PG_FLOAT8', 'PG_False', 'PG_INET', 'PG_INT2', 'PG_INT2VECTOR', 'PG_INT4', 'PG_INT8', 'PG_INTEGER', 'PG_INTERVAL', 'PG_LINE', 'PG_LSEG', 'PG_MACADDR', 'PG_MONEY', 'PG_NAME', 'PG_NUMERIC', 'PG_OID', 'PG_OIDVECTOR', 'PG_PATH', 'PG_POINT', 'PG_POLYGON', 'PG_REFCURSOR', 'PG_REGPROC', 'PG_RELTIME', 'PG_ROWID', 'PG_SMALLINT', 'PG_TEXT', 'PG_TID', 'PG_TIME', 'PG_TIMESTAMP', 'PG_TIMESTAMPTZ', 'PG_TIMETZ', 'PG_TINTERVAL', 'PG_True', 'PG_UNKNOWN', 'PG_VARBIT', 'PG_VARCHAR', 'PG_XID', 'PG_ZPBIT', 'POLLING_ACTIVE', 'POLLING_FAILED', 'POLLING_OK', 'POLLING_READING', 'POLLING_WRITING', 'PQconndefaults', 'PQconnectdb', 'PQftypeName', 'PQresStatus', 'PQresType', 'PgArray', 'PgBoolean', 'PgBooleanFromInteger', 'PgBooleanFromString', 'PgBooleanType', 'PgBytea', 'PgConnectionType', 'PgInt2', 'PgInt2Type', 'PgInt8', 'PgInt8Type', 'PgLargeObject', 'PgLargeObjectType', 'PgMoney', 'PgNumeric', 'PgOther', 'PgQuoteBytea', 'PgQuoteString', 'PgResultSet', 'PgResultType', 'PgTypes', 'PgUnQuoteBytea', 'PgVersion', 'PgVersionType', 'ProgrammingError', 'RESULT_DDL', 'RESULT_DML', 'RESULT_DQL', 'RESULT_EMPTY', 'RESULT_ERROR', 'ROWID', 'STRING', 'SliceType', 'StringType', 'StringTypes', 'TUPLES_OK', 'Time', 'TimeFromTicks', 'Timestamp', 'TimestampFromTicks', 'TracebackType', 'TupleType', 'TypeCache', 'TypeType', 'UnboundMethodType', 'UnicodeType', 'Warning', 'XRangeType', '__builtins__', '__doc__', '__file__', '__name__', '_handleArray', '_quote', '_quoteall', 'apilevel', 'connect', 'copy', 'dateTimeDelta2Interval', 'fetchReturnsList', 'getdefaultencoding', 'getrefcount', 'libpq', 'make_PgResultSetClass', 'new', 'noPostgresCursor', 'noWeakRef', 'paramstyle', 're', 're_4UP', 're_DQL', 're_DRI', 're_DRT', 'replace', 'string', 'sys', 'threadsafety', 'version', 'weakref'] httpd.conf: LoadModule python_module /var/www2/modules/mod_python.so <Directory /var/www2/htdocs/billing> SetHandler python-program PythonHandler mod_python.publisher </Directory>
|