IOError: open failed

1,941 views
Skip to first unread message

Jeremy Gooch

unread,
Feb 28, 2015, 7:25:22 AM2/28/15
to py...@googlegroups.com
Hello,

I noticed last week that my weather station seemed to have dropped down to only updating Weather Underground and WOW hourly and had stopped tweeting.  I logged onto my pi, and it seemed to have some problems (for instance "ps" wasn't working and "api-get" complained about a segmentation fault).  I decided to rebuild the Pi, on the assumption that the SD card was probably on the way out, and thinking that I could get the weather station up for a week or two, whilst I sorted out a new SD card.

Before I rebuilt it, I tried running pywws in a shell, and it failed with an IO error.  I put this down to whatever fault was on the SD card.

NB My weather station writes all of its data to a USB drive, so I am assuming that whatever corruption was on the SD card hasn't affected the weather data.

I've just finished the rebuild of the Pi (and the weird segmentation errors have gone away - e.g. I can now "ps"), but I'm still getting the same IO error from pywws.  Here's the output:-

jeremy@raspberrypi ~ $ python -m pywws.TestWeatherStation
12:15:16:pywws.Logger:pywws version 15.01.0
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/pywws/TestWeatherStation.py", line 180, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/pywws/TestWeatherStation.py", line 115, in main
    ws = WeatherStation.weather_station()
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 392, in __init__
    self.cusb = CUSBDrive()
  File "/usr/local/lib/python2.7/dist-packages/pywws/WeatherStation.py", line 239, in __init__
    self.dev = USBDevice(0x1941, 0x8021)
  File "/usr/local/lib/python2.7/dist-packages/pywws/device_cython_hidapi.py", line 71, in __init__
    self.hid = hid.device(idVendor, idProduct)
  File "hid.pyx", line 45, in hid.device.__cinit__ (hid.c:1102)
IOError: open failed

Any suggestions gratefully received.

Thanks,

J.

Jim Easterbrook

unread,
Feb 28, 2015, 7:31:28 AM2/28/15
to py...@googlegroups.com
On 28/02/15 12:25, Jeremy Gooch wrote:
>
> I've just finished the rebuild of the Pi (and the weird segmentation
> errors have gone away - e.g. I can now "ps"), but I'm still getting the
> same IO error from pywws. Here's the output:-
>
> jeremy@raspberrypi ~ $ python -m pywws.TestWeatherStation
> 12:15:16:pywws.Logger:pywws version 15.01.0
> Traceback (most recent call last):

[snip]

> "/usr/local/lib/python2.7/dist-packages/pywws/device_cython_hidapi.py",
> line 71, in __init__
> self.hid = hid.device(idVendor, idProduct)
> File "hid.pyx", line 45, in hid.device.__cinit__ (hid.c:1102)
> IOError: open failed

The hid library is very uninformative, but you might have a permissions
problem. Test this by trying pywws-testweatherstation with sudo.

Then install libusb1 or pyusb (using pip) to use libusb directly instead
of via hidapi.
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

Peter Mount

unread,
Feb 28, 2015, 7:42:50 AM2/28/15
to py...@googlegroups.com

One thing I had spotted recently on one of my webservers was similar to this, including not being able run ps etc.

It might have been unrelated to what you had but in that instance the filesystem had run out of free iNodes so nothing ran.

Clearing down some files & running fsck did the trick in that case but I'd had only done a rebuild if that had failed & the only times I've had that with PI's was when the sdcard had died.

--
You received this message because you are subscribed to the Google Groups "pywws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywws+un...@googlegroups.com.
To post to this group, send email to py...@googlegroups.com.
Visit this group at http://groups.google.com/group/pywws.
For more options, visit https://groups.google.com/d/optout.

Jeremy Gooch

unread,
Feb 28, 2015, 7:55:51 AM2/28/15
to py...@googlegroups.com
Thanks - this looks like a good lead.

jeremy@raspberrypi /media/USBHDD1/weather/data $ sudo python -m pywws.TestWeatherStation
[sudo] password for jeremy:
12:53:13:pywws.Logger:pywws version 15.01.0
0000 55 aa ff ff ff ff ff ff ff ff ff ff ff ff ff ff 05 20 08 31 09 00 00 00 00 00 00 f0 0f 00 60 94
0020 05 27 e3 26 00 00 00 00 00 00 00 15 02 28 13 54 41 23 c8 00 00 00 46 2d 2c 01 64 80 c8 00 00 00
0040 64 00 64 80 a0 28 80 25 a0 28 80 25 00 70 00 00 df 00 00 0a 00 f4 01 12 00 00 00 00 00 00 00 00
0060 00 00 54 24 63 0c 32 01 5c 00 5c 01 39 80 5c 01 4e 80 de 00 a1 80 60 28 7d 25 82 28 9f 25 b7 01
0080 bd 01 bb 02 90 06 5f 0a 58 0e 31 38 00 14 04 20 12 45 14 07 27 15 20 13 04 09 04 50 13 05 02 17
00a0 13 14 07 18 15 54 14 12 14 13 51 13 08 01 17 51 15 01 23 06 12 13 08 01 17 51 14 12 27 02 07 14
00c0 07 18 10 47 14 08 12 06 55 14 12 29 20 52 14 02 14 23 48 14 12 29 20 52 14 02 14 23 48 14 08 12
00e0 06 55 14 08 12 06 55 14 12 14 13 31 14 02 15 16 48 14 02 15 16 48 14 02 15 16 48 15 02 26 14 07

How do I identify which file is inaccessible?  I've had the weather station running under my own ID since I first installed pywws and I don't think anyone had logged onto the pi for a few weeks before it went wrong.

J.

Jeremy Gooch

unread,
Feb 28, 2015, 7:57:47 AM2/28/15
to py...@googlegroups.com, pe...@retep.org.uk
Hi Peter - thanks for the tip.  I ran fsck against the SD card this morning, but it wasn't particularly informative, so I went ahead and did the rebuild anyway (I've done it twice before and am getting pretty quick!).

I think there might be two problems here - an SD card fault, now fixed but probably symptomatic of a card on the way out, and something hooky with some of the pywws files.

J.

Jim Easterbrook

unread,
Feb 28, 2015, 7:59:51 AM2/28/15
to py...@googlegroups.com
It's not a file, it's the USB device. You need a 'udev' rule. See
http://jim-jotting.blogspot.co.uk/2013/10/my-first-raspberry-pi-day-4.html

Jeremy Gooch

unread,
Feb 28, 2015, 8:27:44 AM2/28/15
to py...@googlegroups.com




(...embarrassed pause as I realise I skipped a step in my list of rebuild commands)





Many thanks - that was it.  "Doh" is probably the word to use here.

J.
Reply all
Reply to author
Forward
0 new messages