Timed out and 2 parallels scripts

Supporting 2.7 and 3.2+
DSX
Phidgetsian
Posts: 9
Joined: Fri Dec 15, 2017 9:10 am
Contact:

Re: Timed out and 2 parallels scripts

Postby DSX » Sat Feb 03, 2018 8:52 am

I'm still tyring but nothing...

No more ideas ?

Thanks

User avatar
Patrick
Lead Developer
Posts: 3001
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Timed out and 2 parallels scripts

Postby Patrick » Mon Feb 05, 2018 4:03 pm

Try increasing the timeout in phidgetadmin

DSX
Phidgetsian
Posts: 9
Joined: Fri Dec 15, 2017 9:10 am
Contact:

Re: Timed out and 2 parallels scripts

Postby DSX » Fri Mar 16, 2018 3:17 am

I've made many tries and here is the informations I have :
phidget22networkserver -D returns

Code: Select all

INFO [netsrv][2018-03-16T10:02:45 server.c+305 main()]: Phidget22NetworkServer 1.1


phidget22admin -R -L -d returns

Code: Select all

(136263) PhidgetInterfaceKit 0/16/16
         (136263/0/0) Digital Input
         (136263/0/1) Digital Input
         (136263/0/2) Digital Input
         (136263/0/3) Digital Input
         (136263/0/4) Digital Input
         (136263/0/5) Digital Input
         (136263/0/6) Digital Input
         (136263/0/7) Digital Input
         (136263/0/8) Digital Input
         (136263/0/9) Digital Input
         (136263/0/10) Digital Input
         (136263/0/11) Digital Input
         (136263/0/12) Digital Input
         (136263/0/13) Digital Input
         (136263/0/14) Digital Input
         (136263/0/15) Digital Input
         (136263/0/0) Digital Output
         (136263/0/1) Digital Output
         (136263/0/2) Digital Output
         (136263/0/3) Digital Output
         (136263/0/4) Digital Output
         (136263/0/5) Digital Output
         (136263/0/6) Digital Output
         (136263/0/7) Digital Output
         (136263/0/8) Digital Output
         (136263/0/9) Digital Output
         (136263/0/10) Digital Output
         (136263/0/11) Digital Output
         (136263/0/12) Digital Output
         (136263/0/13) Digital Output
         (136263/0/14) Digital Output
         (136263/0/15) Digital Output

but the without -L it returns nothing.

I think now my server is launched, here is my script :

Code: Select all

#!/usr/bin/python

import sys
import time
import mysql.connector
from Phidget22.Devices.DigitalInput import *
from Phidget22.PhidgetException import *
from Phidget22.Phidget import *
from Phidget22.Net import *

def StateChangeHandler(e, state):
   print("Channel %d : %f" % (e.getChannel(), state))

def ErrorEvent(e, eCode, description):
   print("Error %i : %s" % (eCode, description))

try:
   print('debut')
   Net.enableServerDiscovery(PhidgetServerType.PHIDGETSERVER_DEVICEREMOTE)
   Net.addServer('Phidget22 Server', '192.168.0.11', 5661, '', 0)
   print('add')
   
   ch0 = DigitalInput()
   ch0.setOnStateChangeHandler(StateChangeHandler)
   ch0.setOnErrorHandler(ErrorEvent)
   ch0.setDeviceSerialNumber(136263)
   ch0.setChannel(0)
   ch0.setIsRemote(1)
   ch0.open()

except PhidgetException as e:
   print("Runtime Exception %s" % e.details)
   print("Press Enter to Exit...\n")
   readin = sys.stdin.read(1)
   exit(1)

while 1:
   time.sleep(10)

exit(0)

And it does nothing...
I know about the infinite loop, but wihtout it, the scripts stops.

Please tell me if you have any idea. Thank you in advance.
Regards

User avatar
Patrick
Lead Developer
Posts: 3001
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Timed out and 2 parallels scripts

Postby Patrick » Fri Mar 16, 2018 11:14 am

Try removing the enableServerDiscovery line - you don't need this and addServer.

If your running the script on the same machine as the server, use 'localhost' instead of the IP address in the addServer line.

Replace open with openWaitForAttachement and a timeout - try 5000ms. If this still doesn't connect, enable logging in your Python program, and see if there are any errors. Also, have a look at the network server log after trying to connect - there should be some incoming connection messages.

-Patrick

DSX
Phidgetsian
Posts: 9
Joined: Fri Dec 15, 2017 9:10 am
Contact:

Re: Timed out and 2 parallels scripts

Postby DSX » Thu Mar 22, 2018 12:13 pm

Really thank you, it works !

Finally I can watch 8 inputs and activate outputs at the same time.


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest