How/where to store calibration values - written by program A, read by program B
Richard Damon
richard at damon-family.org
Thu Dec 28 10:49:52 EST 2023
On 12/28/2023 12:20 AM EST rbowman via Python-list
<[1]python-list at python.org> wrote:
On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote:
The biggest caveat is that the shared variable MUST exist before it
can
be examined or used (not surprising).
There are a few other questions. Let's say config.py contains a variable
like 'font' that is a user set preference or a calibration value
calculated by A to keep with the thread title. Assuming both scripts are
running, how does the change get propagated to B after it is set in A
and
written to the shared file? Is there a mechanism to allow both scripts
to
make updates?
The easy way out is to assume the changes will be picked up when the
scripts are restarted but this is not always acceptable.
--
[2]https://mail.python.org/mailman/listinfo/python-list
If one module does a:
import config
config.font = "New Value"
Then every other module in that program that also did a
import config
will see the new value of that variable, as the assignment rebound the
name in the module namespace to the new value.
Note, it does NOT work if you did a
from config import font
font = "New Value"
as that doesn't change the binding in the config module.
IF you need to propagate to a different process, you need something
different.
References
Visible links
1. mailto:python-list at python.org
2. https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list