Julian Ciccale
jciccale at mac.com
Mon Nov 24 23:38:06 EST 2003
Have you checked apache's error_log? May be some "C" python module isn't loading in apache by some reason (probably LD_LIBRARY_PATH) or something. - julcicc - On Monday, November 24, 2003, at 05:37PM, Keith Randall <randallk at cpsc.ucalgary.ca> wrote: > > > >On Mon, 24 Nov 2003, Julian Ciccale wrote: > >> Which python version are you using? >> >> Are you sure the python interpreter that you use from the command line and the one that gets called wihthin httpd are the same? >> >> Check it with >> import sys >> print sys.version >> > >Yep, they're the same: > >apache: >[Mon Nov 24 09:05:06 2003] [notice] Apache/2.0.48 (Unix) mod_python/3.1.2b Python/2.3.2 configured > >vs. >python -v > >Python 2.3.2 (#2, Nov 12 2003, 23:39:57) >[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2 > >(and there's only one 2.3.2 installed ). > >sys.path is identical for both as well ( except for the script's own directory, which is >chrooted to htdocs by apache as expected.) > >Also the path to pyPgSQL is readable by all, everything was built from source, no rpms. > >python 2.3.2 >pyPgSQL 2.4 >mod_python 3.1.2b >apache 2.0.48 >postgresql 7.4 > >Keith > >> >> On Monday, November 24, 2003, at 07:02AM, Keith Randall <randallk at cpsc.ucalgary.ca> wrote: >> >> > >> >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 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> >> > >> > >> >_______________________________________________ >> >Mod_python mailing list >> >Mod_python at modpython.org >> >http://mailman.modpython.org/mailman/listinfo/mod_python >> > >> > >> _______________________________________________ >> Mod_python mailing list >> Mod_python at modpython.org >> http://mailman.modpython.org/mailman/listinfo/mod_python >> > > > >
|