Server error when importing XLS file

Bug #306339 reported by budgester
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SchoolTool
Fix Released
High
Alan Elkner
1.0
Fix Released
Medium
Gediminas Paulauskas
1.4
Fix Released
High
Alan Elkner
1.7
Fix Released
High
Alan Elkner

Bug Description

Tried importing sample XLS spreadsheet from

http://ignas.pov.lt/sample_data_export.xls

Achieved the following

Exception

  XLRDError: No sheet named <'Resources'>
Traceback

  File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 133, in publish
  result = publication.callObject(request, obj)
File "/usr/lib/python2.4/site-packages/zope/app/publication/zopepublication.py", line 167, in callObject
  return mapply(ob, request.getPositionalArguments(), request)
File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 108, in mapply
  return debug_call(obj, args)
Extra information: <zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/lib/python2.4/site-packages/schooltool/export/templates/import.pt object at 0x6296310>
File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 114, in debug_call
  return obj(*args)
File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/simpleviewclass.py", line 44, in __call__
  return self.index(*args, **kw)
File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 51, in __call__
  sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/usr/lib/python2.4/site-packages/zope/pagetemplate/pagetemplate.py", line 115, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations)()
Template "/usr/lib/python2.4/site-packages/schooltool/export/templates/import.pt"
File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 586, in do_setLocal_tal
  self.engine.setLocal(name, self.engine.evaluateValue(expr))
File "/usr/lib/python2.4/site-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "/usr/lib/python2.4/site-packages/schooltool/export/templates/import.pt", line 1, column 0
  Expression: <PathExpr standard:u'view/update'>
File "/usr/lib/python2.4/site-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.4/site-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.4/site-packages/schooltool/export/simporter.py", line 578, in update
  self.import_resources(wb)
File "/usr/lib/python2.4/site-packages/schooltool/export/simporter.py", line 315, in import_resources
  sh = wb.sheet_by_name('Resources')
File "/usr/lib/python2.4/site-packages/xlrd/__init__.py", line 659, in sheet_by_name
  raise XLRDError('No sheet named <%r>' % sheet_name)

Revision history for this message
budgester (budgester) wrote :
Download full text (3.2 KiB)

Added Resources sheet to spread sheet and tried to re-import and got the following.

Exception

  IndexError: list index out of range
Traceback

  File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 133, in publish
  result = publication.callObject(request, obj)
File "/usr/lib/python2.4/site-packages/zope/app/publication/zopepublication.py", line 167, in callObject
  return mapply(ob, request.getPositionalArguments(), request)
File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 108, in mapply
  return debug_call(obj, args)
Extra information: <zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/lib/python2.4/site-packages/schooltool/export/templates/import.pt object at 0x579f0d0>
File "/usr/lib/python2.4/site-packages/zope/publisher/publish.py", line 114, in debug_call
  return obj(*args)
File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/simpleviewclass.py", line 44, in __call__
  return self.index(*args, **kw)
File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.4/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 51, in __call__
  sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/usr/lib/python2.4/site-packages/zope/pagetemplate/pagetemplate.py", line 115, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations)()
Template "/usr/lib/python2.4/site-packages/schooltool/export/templates/import.pt"
File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.4/site-packages/zope/tal/talinterpreter.py", line 586, in do_setLocal_tal
  self.engine.setLocal(name, self.engine.evaluateValue(expr))
File "/usr/lib/python2.4/site-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "/usr/lib/python2.4/site-packages/schooltool/export/templates/import.pt", line 1, column 0
  Expression: <PathExpr standard:u'view/update'>
File "/usr/lib/python2.4/site-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.4/site-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.4/site-packages/schooltool/export/simporter.py", line 581, in update
  self.import_sections(wb)
File "/usr/lib/python2.4/site-packages/schooltool/export/simporter.py", line 504, in import_sections
  row = self.import_section(sh, row)
File "/usr/lib/python2.4/site-packages/schooltool/export/simporter.py", line 495, in import_section
  row = self.import_timetables(sh, row, section)
File "/usr/lib/python2.4/site-packages/schooltool/export/simporter.py", line 444, in import_timetables
  self.import_timetable(sh, row, section)
File "/usr/lib/python2.4/site-packages/schooltool/export/simporter.py", line 430, in import_timetable
  resources[day_id, period_id] = sh.cell_value(rowx=row, colx=2)
File "/usr/lib/python2.4/site-packages/xlrd/sheet.py"...

Read more...

Revision history for this message
budgester (budgester) wrote :

Worked this out now, by using the following file.

/usr/lib/python2.5/site-packages/schooltool/export/sample_data.xls

This is on intrepid with the install run from apt-get install schooltool-2008

Revision history for this message
budgester (budgester) wrote :

However failing gracefully would be nice.

Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

Yes, that's what Ignas is working on this week. And I'll work on documentation as soon as I get our 2009 budget done...

Changed in schooltool:
status: New → Fix Released
Revision history for this message
missthom (thompt) wrote :

Dear All,
 I have same Problems when I try to import sample data into Schooltool: Error Description following:

Exception
 IndexError: list index out of range
Ghi băng lại

  File "/usr/lib/python2.5/site-packages/zope/publisher/publish.py", line 133, in publish
  result = publication.callObject(request, obj)
File "/usr/lib/python2.5/site-packages/zope/app/publication/zopepublication.py", line 167, in callObject
  return mapply(ob, request.getPositionalArguments(), request)
File "/usr/lib/python2.5/site-packages/zope/publisher/publish.py", line 108, in mapply
  return debug_call(obj, args)
Extra information: <zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/lib/python2.5/site-packages/schooltool/export/templates/import.pt object at 0xbabdb4c>
File "/usr/lib/python2.5/site-packages/zope/publisher/publish.py", line 114, in debug_call
  return obj(*args)
File "/usr/lib/python2.5/site-packages/zope/app/pagetemplate/simpleviewclass.py", line 44, in __call__
  return self.index(*args, **kw)
File "/usr/lib/python2.5/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 83, in __call__
  return self.im_func(im_self, *args, **kw)
File "/usr/lib/python2.5/site-packages/zope/app/pagetemplate/viewpagetemplatefile.py", line 51, in __call__
  sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
File "/usr/lib/python2.5/site-packages/zope/pagetemplate/pagetemplate.py", line 115, in pt_render
  strictinsert=0, sourceAnnotations=sourceAnnotations)()
Template "/usr/lib/python2.5/site-packages/schooltool/export/templates/import.pt"
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 271, in __call__
  self.interpret(self.program)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 346, in interpret
  handlers[opcode](self, args)
File "/usr/lib/python2.5/site-packages/zope/tal/talinterpreter.py", line 586, in do_setLocal_tal
  self.engine.setLocal(name, self.engine.evaluateValue(expr))
File "/usr/lib/python2.5/site-packages/zope/tales/tales.py", line 696, in evaluate
  return expression(self)
Template "/usr/lib/python2.5/site-packages/schooltool/export/templates/import.pt", line 1, column 0
  Expression: <PathExpr standard:u'view/update'>
File "/usr/lib/python2.5/site-packages/zope/tales/expressions.py", line 217, in __call__
  return self._eval(econtext)
File "/usr/lib/python2.5/site-packages/zope/tales/expressions.py", line 211, in _eval
  return ob()
File "/usr/lib/python2.5/site-packages/schooltool/export/importer.py", line 722, in update
  imp.import_data(wb)
File "/usr/lib/python2.5/site-packages/schooltool/export/importer.py", line 108, in import_data
  return self.process()
File "/usr/lib/python2.5/site-packages/schooltool/export/importer.py", line 438, in process
  data['gender'] = sh.cell_value(rowx=row, colx=8)
File "/usr/lib/python2.5/site-packages/xlrd/sheet.py", line 253, in cell_value
  return self._cell_values[rowx][colx]

Tom Hoffman, can you help me?

Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

Justas, can you look at missthom's traceback, please?

Changed in schooltool:
assignee: nobody → Justas Sadzevičius (justas-pov)
importance: Undecided → High
milestone: none → karmic
status: Fix Released → New
Changed in schooltool:
status: New → Triaged
Revision history for this message
Justas Sadzevičius (justas.sadzevicius) wrote :

It seems that you are using the old sample data XLS. To obtain the new one, go to the "XLS Import" page in your SchoolTool and click on the "sample_data.xls" link.

Thank you for your bug report. We'll implement more user-friendly handling of this error for the next SchoolTool bugfix release.

Changed in schooltool:
milestone: karmic → 2009.4.14
Changed in schooltool:
milestone: 2009.4.14 → august-1
Changed in schooltool:
milestone: august-1 → karmic
Changed in schooltool:
milestone: lucid → 1.4.0
tags: added: import
tags: added: traceback
Revision history for this message
Gediminas Paulauskas (menesis) wrote :

I assume the sample XLS file you can download from SchoolTool works, but some older file from internet doesn't? So use the newer file...

Changed in schooltool:
status: Triaged → Won't Fix
Changed in schooltool:
milestone: 1.4.0 → next
Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

Is this "won't fix" or assigned to the next milestone? It can't be both.

Revision history for this message
Gediminas Paulauskas (menesis) wrote :

I don't think we need to fix importing those old files, thus Won't fix.
But still, more graceful handling of missing sheets would be nice to have, thus I want someone to look at it for next milestone.

Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

Alan's been working more on the spreadsheet import.

Changed in schooltool:
assignee: Justas Sadzevičius (justas-pov) → Alan Elkner (aelkner)
Alan Elkner (aelkner)
Changed in schooltool:
status: Won't Fix → In Progress
Changed in schooltool:
milestone: next → 1.5.0
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.