Author Topic: Help! My Vox isn't running a command except for via the green arrow in cmd edit!  (Read 8208 times)

0 Members and 1 Guest are viewing this topic.

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
I can do it, but my parents won't let me do it over TeamViewer, can we please do it over Skype with screen-sharing?

15:30 my time is okay (9:30 am for you). I will PM you with my skype id, so that you can call me then.

Oskar
What you can´t do now... Go learn it!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Yes. It will cause the exact issue that you are having. That is what I am telling you.  Once loaded, it is always loaded even after you resume from hibernation. I'm telling you that the problem is created by you loading it more than once. Stop loading that script more than once and your problem will go away.

You can still call the functions to close and open the serial port but don't execute the script more than once.

01ste02

  • $upporter
  • Jr. Member
  • *****
  • Posts: 37
  • Karma: 1
  • 16 Years old hobby-developer in home-automation
    • View Profile
    • Company website (Swedish and incomplete)
Ok, I will try that in one hour. If the problem persists will the "support-time" still be on?
« Last Edit: March 05, 2016, 08:59:19 AM by jitterjames »
What you can´t do now... Go learn it!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
I can say that it looks like you are redefining the serial port which was already defined when the script ran on the VC.Loaded event.  As soon as you redefine the Serial port you have created a new instance of it and have lost the handle to the original object which means you can no longer close it!  (I think).

Since your script is defining a gloabal variable for the serial port, make sure that you only run that script once, and all your other scripts can continue to use it.


As I suspected, this problem was resolved by not running the python script (which creates the serial port object) repeatedly.  It should only be run once on VC.Loaded and never after that.  The port can be opened and closed repeatedly but the port itself should not be recreated when it is already open or we lose the ability to close it except by restarting VC.