Hello all,

I am new to this forum and to python as well. I do have to say that I do have some C, MATLAB, and Igor programming experience that is helping me with my current project but not enough though. Let me explain first and then I will provide an example of my code and what is doing. Where I work (a science instructor at Talcott Mountain Science Center in Avon CT), we have a weather station that we would like to send data to the web from the console that is collecting data. The weather station is nothing elaborate at the time being, it is an Ambient Weather WS-2080 setup. The program will first find the station console and then read the current data. Then it will apply any and all conversions before writing the data to a file that can then be uploaded to wunderground.com. I currently have had progress in getting the program to find the weather station but then that is all. I have, of course PyUSB and LibUSBWin32 for a 64 bit OS installed on my system.

This is the code I have so far that works:

#USB Test.py

import sys
import usb.core
import usb.util
import usb.control
import usb.legacy

print "Checking for USB"
#find the device/ In this instance my HP Flash Drive.
dev = usb.core.find(idVendor=0x03f0, idProduct=0x3d07)

#dev1 is the weather station console
dev1 = usb.core.find(idVendor=0x1941, idProduct=0x8021)


if dev is None:
# raise ValueError('HP 4Gb Flash drive not found!')
print "USB Flash Drive not found"
print "USB Flash Drive found"

if dev1 is None:
#raise ValueError('MSG')
print "Check USB conection to Weather Station"
print "Weather Station found"

#read the usb?
devread = usb.core.Device.read(dev1,0xA1,256)

The program will work up to the last line and then it will produce the following error:

"Traceback (most recent calls last):
File 'test_usb.py', line #in <module>
devread = usb.core.Device.read(dev1,0xA1,256)
File 'C:\Python27\lib\site-packages\usb\core.py', line 646 in read fn = fn_map[self.ctx.get_endpoint_type(self,endpoint,intf)]
File 'C:\Python27\lib\site-packages\usb\core.py', line 181 in get_end_point_type etype = util.endpoint_type(e.bmAttributes)
AttributeError: 'NoneType' object has no attribute 'bmAttributes'

I am not sure what the error means or how to fix it. I have looked at code for pywws and the tutorial for PyUSB but it doesn't help. At least for me it doesn't.

If I can get to where I can read data off the console right now, I believe I will be in good shape for a while on this project. It is just getting the USB communication horse **** figured out. Also, I apologize if this has already been addressed on this forum and if so please point me to the post. I have been searching the web and forums for the past couple of weeks to no avail. Thank you in advance.