Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44970

Re: Globally available I/O connection (K8055 I/O board)

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'exception.': 0.09; 'messing': 0.09; 'subject:board': 0.09; 'python': 0.11; 'called.': 0.16; 'code?': 0.16; 'imports': 0.16; 'script,': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'module': 0.19; 'trying': 0.19; 'mechanism': 0.19; 'value.': 0.19; 'import': 0.22; 'header:User- Agent:1': 0.23; 'circular': 0.24; 'documented': 0.24; 'module,': 0.24; 'looks': 0.24; 'question': 0.24; "i've": 0.25; 'script': 0.25; 'logging': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'record': 0.27; 'function': 0.29; "i'm": 0.30; 'gives': 0.31; 'that.': 0.31; 'globally': 0.31; 'once,': 0.31; 'run': 0.32; '(including': 0.33; 'could': 0.34; 'subject: (': 0.35; 'board': 0.35; 'connection': 0.35; 'there': 0.35; 'accessing': 0.36; 'doing': 0.36; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'hardware': 0.61; 'new': 0.61; "you're": 0.61; 'here:': 0.62; 'email addr:gmail.com': 0.63; 'more': 0.64; 'received:74.208': 0.68; 'saving': 0.69; "it'd": 0.84; 'received:74.208.4.194': 0.84; "they'd": 0.84; 'mistake': 0.91; 'subject:available': 0.93
Date Wed, 08 May 2013 17:20:54 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5
MIME-Version 1.0
To python-list@python.org
Subject Re: Globally available I/O connection (K8055 I/O board)
References <c1c5718f-07b3-45c7-ba28-3bb9164b5210@googlegroups.com>
In-Reply-To <c1c5718f-07b3-45c7-ba28-3bb9164b5210@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:tCXpz4l4eaPPsek1Dnzg5w+nKEf/NwNpjAEHZZAMRvQ HtE6Fz1GmEt4F/U5BzHoNn+aiQiu5FRomMcO5U5FGttzFRFJ7H P9dfb+AMv11YKoeI8mjxK7NoDU+5yLOr3RKRGD5GT/goB0/M9f Am3qNfHB/g/0fUlQrmQm17o4qu07+kr3cD0SdJ9UT2z2Fup4W7 t9x+emoALJpoVi/mS00fzlT5Tqwi/T489aa7U1IBZSD7cdkGTx AYcUe+E/xr79vUoRbDKHwan1vqfCbUmi2qMCtZvkhG/vKXkaOi 0YCCwkqOKNIenc/arNjaSBC9pW8WtDlzl32Muyajtg4Rc22tQ= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1463.1368048077.3114.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1368048077 news.xs4all.nl 15874 [2001:888:2000:d::a6]:53653
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44970

Show key headers only | View raw


On 05/08/2013 04:50 PM, flexage@gmail.com wrote:
> I'm having a bit of an issue trying to make a globally available connection to my Velleman K8055 I/O board...
>
> I've documented my issue as best I can here: http://stackoverflow.com/questions/16449706/python-access-global-instance-of-connection
>

I don't think that's a Python question at all.  You have some constraint 
your hardware gives you that requires you to run function k8055(0) once, 
and to use that result object to access the board subsequently.  Looks 
to me like you're doing exactly that.  Are there any other calls to that 
function in your code?

If you were messing up with your access to the global object 
globalK8055, you'd get an exception.

The only Python mistake I can think of that you might be doing is if 
you're using your script as a module, or otherwise doing circular 
imports, or if you're accessing some module under more than one name.

In particular, if you run SmartyPi/appglobals.py as a script, it'd be 
calling the k8055() function once and saving the value.  And then when 
somebody imports it as
     from smartypi.appglobals import globalK8055 as k

they'd get a NEW instance of the module and a new value for globalK8055.

If you have some form of logging mechanism (including print), you could 
record each time the k8055() is called.


-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Globally available I/O connection (K8055 I/O board) flexage@gmail.com - 2013-05-08 13:50 -0700
  Re: Globally available I/O connection (K8055 I/O board) Dave Angel <davea@davea.name> - 2013-05-08 17:20 -0400

csiph-web