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


Groups > comp.lang.python > #44968 > unrolled thread

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

Started byflexage@gmail.com
First post2013-05-08 13:50 -0700
Last post2013-05-08 17:20 -0400
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  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

#44968 — Globally available I/O connection (K8055 I/O board)

Fromflexage@gmail.com
Date2013-05-08 13:50 -0700
SubjectGlobally available I/O connection (K8055 I/O board)
Message-ID<c1c5718f-07b3-45c7-ba28-3bb9164b5210@googlegroups.com>
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

Could anybody shed some light on a way to combat my problem?

[toc] | [next] | [standalone]


#44970

FromDave Angel <davea@davea.name>
Date2013-05-08 17:20 -0400
Message-ID<mailman.1463.1368048077.3114.python-list@python.org>
In reply to#44968
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web