Page 1 of 1

phidget and spyder problem time

Posted: Sun Jun 20, 2021 8:54 am
by nmadonia
I encounter a problem with spyder in fact every time I start the script after a few minutes this message appears:

Code: Select all

runfile('C:/Phidget/Phidget_HUM1001_0_Python_Example/example.py', wdir='C:/Phidget/Phidget_HUM1001_0_Python_Example')
Traceback (most recent call last):

  File "C:\Phidget\Phidget_HUM1001_0_Python_Example\example.py", line 38, in <module>
    main()

  File "C:\Phidget\Phidget_HUM1001_0_Python_Example\example.py", line 29, in main
    humiditySensor0.openWaitForAttachment(20000)

  File "C:\Users\Nicol\anaconda3\lib\site-packages\phidget22-1.7.20210504-py3.8.egg\Phidget22\Phidget.py", line 574, in openWaitForAttachment
    raise PhidgetException(result)

PhidgetException: PhidgetException 0x03 (Timed Out)
No matching devices were found to open. Make sure your device is attached, and that your addressing parameters are specified correctly. If your Phidget has a plug or terminal block for external power, ensure it is plugged in and powered.
Make sure to enable server discovery, or add the server, and to set the server password if autentication is enabled.

My PhidgetSBC 4 is connected to my laptop with an eternet cat6 connection.

I tried to check the ports to which my Humidity sensor is attached. I read that it doesn't support two open windows and so I closed everything. I write the code (it is that of the example).

Code: Select all

from Phidget22.Phidget import *
from Phidget22.Net import *
from Phidget22.Devices.Log import *
from Phidget22.LogLevel import *
from Phidget22.Devices.HumiditySensor import *
import time

def onHumidityChange(self, humidity):
	print("Humidity: " + str(humidity))

def onError(self, code, description):
	print("Code: " + ErrorEventCode.getName(code))
	print("Description: " + str(description))
	print("----------")

def main():
	Log.enable(LogLevel.PHIDGET_LOG_INFO, "phidgetlog.log")
	Net.enableServerDiscovery(PhidgetServerType.PHIDGETSERVER_DEVICEREMOTE)

	humiditySensor0 = HumiditySensor()

	humiditySensor0.setHubPort(0)
	humiditySensor0.setIsRemote(True)
	humiditySensor0.setDeviceSerialNumber(592071)

	humiditySensor0.setOnHumidityChangeHandler(onHumidityChange)
	humiditySensor0.setOnErrorHandler(onError)

	humiditySensor0.openWaitForAttachment(20000)

	try:
		input("Press Enter to Stop\n")
	except (Exception, KeyboardInterrupt):
		pass

	humiditySensor0.close()

main()
I thank you in advance

Re: phidget and spyder problem time

Posted: Mon Jun 21, 2021 8:39 am
by mparadis
There are a couple of reasons you could be getting a timeout error when calling openWaitForAttachment(). Ultimately it means it couldn't find the Phidget channel because:

- Incorrect matching parameters (e.g. wrong serial number)
- Insufficient power supply on the Phidget (often happens when many devices are on the same low-power USB hub)
- Channel is already open locally in another program or process (including Phidget Control Panel)
- When opening remotely, timeout will occur if the Network Server is not running on the computer the Phidget is connected to.

I would first see if you can get it to show up as a remote server in the Phidget control panel on your laptop. If that doesn't work then it's probably a problem with the Network Server or the network itself (e.g. client is on the wrong wifi network or router configuration is blocking traffic)

Re: phidget and spyder problem time

Posted: Mon Jun 28, 2021 8:43 am
by nmadonia
THANK YOU VERY MUCH.
You're always very kind. I have solved.
Nicolas