"Is a directory" - This Python error is both correct and unhelpful

10,164 views
Skip to first unread message

stetho

unread,
Jul 5, 2012, 5:34:58 PM7/5/12
to py...@googlegroups.com
I was having a problem with my original install of pywws and I never got it to work correctly so I built a VM with Ubuntu Server 10.04 and installed all the requirements from packages. Now I have a different error message which I can't get to the bottom of and it's driving me crazy.

My weather.ini includes the lines

[paths]
templates = /home/steve/weather/templates/
work = /tmp/weather
graph_templates = /home/steve/weather/graph_templates/

Running any of the logging programs (hourly, live, etc) results in the message

22:21:27:pywws:[Errno 21] Is a directory: '/home/steve/weather/graph_templates/'
Traceback (most recent call last):
  File "LiveLog.py", line 137, in <module>
    sys.exit(main())
  File "LiveLog.py", line 132, in main
    return LiveLog(args[0])
  File "LiveLog.py", line 103, in LiveLog
    tasks.do_live(data)
  File "/home/steve/weather/pywws-12.05_r521/pywws/Tasks.py", line 100, in do_live
    upload = self.do_plot(template)
  File "/home/steve/weather/pywws-12.05_r521/pywws/Tasks.py", line 186, in do_plot
    if self.plotter.DoPlot(input_file, output_file) == 0:
  File "/home/steve/weather/pywws-12.05_r521/pywws/Plot.py", line 44, in DoPlot
    self.doc = xml.dom.minidom.parse(input_file)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 1918, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 922, in parse
    fp = open(file, 'rb')
IOError: [Errno 21] Is a directory: '/home/steve/weather/graph_templates/'

What I think it's trying to tell me is that it doesn't expect /home/steve/weather/graph_templates/ to be a directory - but it is and there's not much I can do about it.

Changing the directory path in weather.ini gives the expected error of

IOError: [Errno 2] No such file or directory: '/home/changed_this_bit/weather/graph_templates/'

And removing the final slash from the path makes no difference. 

Can someone tell me what it is I'm missing? The error message is obviously telling me something but I can't see it. It might be a "woods for the trees" situation.

Thanks

Steve

Jim Easterbrook

unread,
Jul 6, 2012, 3:01:38 AM7/6/12
to py...@googlegroups.com
The key here is "self.doc = xml.dom.minidom.parse(input_file)" - which
fails because input_file is a directory. Do you have an empty string in
one of your plot lists in weather.ini?
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

Steve Thompson

unread,
Jul 6, 2012, 5:17:19 AM7/6/12
to py...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "pywws" group.
To post to this group, send email to py...@googlegroups.com.
To unsubscribe from this group, send email to pywws+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pywws?hl=en.

Yes, that was it. If those two things were on the same line - "input_file is a directory" for example - I might have been able to figure it out! Thanks for that.

Steve
Reply all
Reply to author
Forward
0 new messages