Re: Please Explain This Error
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <OF1DE3572B.7B184CF6-ON8525721B.004F9688-8525721B.00500242@bankofny.com> |
The easiest way to do something like this is to have a class that you
create, then reference the variable in the class as in:
class foo:
myvariable = 12
from foo import myvariable
class why:
def printmyvariable(self):
print myvariable
This is psuedo code that I have not tested. You had mentioned that you
couldn't import the other file because of circular dependencies. Now, my
python is rather primative myself, I have only been working with Python
for 2 years, so I still struggle sometimes with best ways and only one
way of doing things :)
Thanks,
Greg Givler
Information Technology
Lockwood®
10 Valley Stream Parkway
Malvern, PA 19355
Phone: (484) 605-4826
Email: [email protected]
Rich Shepard
<rshepard@appl-ecosys To: "For users of the pysqlite database module." <pysqlite-IAPFreCvJWPBWskQ1e/[email protected]>
.com> cc:
Sent by: Subject: Re: [pysqlite] Please Explain This Error
pysqlite-bounces@list
s.initd.org
11/03/2006 09:15 AM
Please respond to
"For users of the
pysqlite database
module."
On Fri, 3 Nov 2006, Liam Clarke wrote:
> Please forward a copy of policyPage.py.
Liam,
I've gone around this error by moving the two database functions
(open and
close) into a separate module/class. Since that class is now imported by
all
the other modules that need database access, I'm trying to learn how to
make
a variable defined in one module -- the name of the database file --
visible
to the functions in the new module.
This variable -- projname -- is local to the wxPthon text entry
function,
global to the MainFrame class, and not a built-in variable. Therefore,
it
is not visible to the openDB() and closeDB() functions in a completely
separate module. I'm trying to learn the python equivalent of C's
'extern'
declaration modifier.
Thanks,
Rich
--
Richard B. Shepard, Ph.D. | The Environmental
Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax:
503-667-8863
_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/pysqlite
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please call the help desk at ext 4850
______________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________