[SQLObject] Importing classes from seperate files
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Scott L. <sle...@in...> - 2003-12-01 03:38:01
|
I'm new to Python and have been frustrated by a problem specific to
SQLObject. I want to create my classes in seperate files/modules and
import them into the application that I'm writing. If I do this and try
to use any of the SQLObject based classes that I've created, I always
end up with an AttributeError
For example, if I try to create a new object with the new method, I'll
get something like.
Traceback (most recent call last):
File "test01.py", line 13, in ?
r = ProcReport.new()
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line
883, in new
inst._SO_finishCreate(id)
File "/usr/lib/python2.2/site-packages/SQLObject/SQLObject.py", line
904, in _SO_finishCreate
id = self._connection.queryInsertID(self._table, self._idName,
AttributeError: 'NoneType' object has no attribute 'queryInsertID'
Now if I copy the class code in the same file as the applicate code
everything works. I've tried importing my class files via 'import
classfile' and 'from classfile import *' without any success.
I realize this is a name space issue, but I thought that the 'from ...
import' statement would resolve this. Can anyone shed some light on
this for me? Can I have my classes in a seperate file or do I have to
put everything in a single file for SQLObject?
--
Scott LeFevre, Consultant
Solutio Informatio
|