[PLUG] Local Python Help?
Rich Shepard
rshepard at appl-ecosys.com
Thu Sep 27 22:11:03 UTC 2007
I thought that PLUG-devel was still alive as a mail list; I was wrong
about this. I've also not had any responses on comp.lang.python to my post,
so, with your forebearance, I'm posting it here.
I'm stymied by what should be a simple Python task: accessing the value of
a variable assigned in one module from within a second module. I wonder if
someone here can help clarify my thinking. I've re-read Chapter 16 (Module
Basics) in Lutz and Ascher's "Learning Python" but it's not working for me.
In one module (the "source"), variablePage.py, three wxPython widgets
display values that are assigned to variables: curVar, UoDlow, and UoDhigh.
I want to display then in equivalent widgets on a wxPython notebook tab in a
different module, the "importer."
At the top of the importer module I have:
from variablePage import curVar, UoDlow, UoDhigh
and I try to display the values of those variables in widgets on this page.
But, python complains:
from variablePage import curVar, UoDlow, UoDhigh
ImportError: cannot import name curVar
I've also tried
import variablePage as VP
and referenced the variables as VP.curVar, VP.UoDlow, and VP.UoDhigh, but
python still doesn't like this:
File "/data1/eikos/fuzSetPage.py", line 364, in loadParVar
first = VP.curVar
AttributeError: 'module' object has no attribute 'curVar'
Both of these forms are used in the book (pages 260-261) in simple
examples. I also get errors if I try importing using the class name before
the variable name.
A clue stick would be very helpful since I am not seeing just what I'm
doing incorrectly.
Rich
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerators(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
More information about the PLUG
mailing list