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

D

Dave Angel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top