On 05/08/2013 04:50 PM, flex...@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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to