Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Importing constantly changing variables Date: Sun, 27 Dec 2015 10:15:19 +1100 Lines: 30 Message-ID: References: <944a9d35-dc31-4074-8d56-bb6e9a0d1d15@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Opx231tPKJKlfy2fVTTykwErYg98/JLl6pim4whvyjag== Cancel-Lock: sha1:aNAO7nPeIpXcB203fJ/eVN56lxU= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'imports': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; ':-)': 0.12; 'english.': 0.13; 'vista': 0.13; 'file,': 0.15; '(more': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'specifics': 0.16; 'subject:changing': 0.16; 'input': 0.18; 'language': 0.19; 'all,': 0.20; 'libraries': 0.22; 'interfaces': 0.23; 'speakers': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'connects': 0.27; 'function': 0.28; 'values': 0.28; 'device': 0.28; 'everyone': 0.31; 'run': 0.33; 'source': 0.33; 'instead,': 0.33; 'interface,': 0.33; 'file': 0.34; 'running': 0.34; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'data': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'email addr:gmail.com': 0.62; 'skip:\xe2 10': 0.70; '\xe2\x80\x93': 0.72; 'physical': 0.72; 'transfer': 0.73; '8bit%:46': 0.76; 'obtained': 0.76; '_o__)': 0.84; 'horrible': 0.84; 'received:125': 0.84; '\xe2\x80\x9cthe': 0.93 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100899 ariklapid.swim@gmail.com writes: > Hello everyone ! > First of all, excuse me for my horrible English. As is often the case with people who make this apology, your English is far better than most native English speakers can use any other language :-) > A file named "sensors.py" imports varying values from physical > sensors. These values are constantly changing. Such values, then, should not be obtained from a Python ‘import’. Instead, you need to come up with a data transfer protocol, or (more likely) make use of an existing one. Your running program will make function calls that get the data from “the outside world” – a file, or a network interface, or some other input to the program. So to solve this you will need to know the specifics of how the device connects to the computer, what interfaces it presents for obtaining the data at run time, and what Python libraries you can use for accessing that interface. -- \ “If you do not trust the source do not use this program.” | `\ —Microsoft Vista security dialogue | _o__) | Ben Finney