Exercise submission is very pedantic about indentation

Bug #575765 reported by David Coles
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IVLE
Fix Released
Medium
David Coles

Bug Description

In worksheets, any whitespace after code can trigger an IndentationError during submit that will not cause an issue when the code run in the console (making it hard to work out why it happens).

For example (using underscores to make spaces more clear):

def x()
____return 3
print x()
____

Related branches

Revision history for this message
David Coles (dcoles) wrote :

Calling str.strip may be enough to solve this issue.

Changed in ivle:
importance: Undecided → Low
status: New → Confirmed
status: Confirmed → Triaged
Revision history for this message
David Coles (dcoles) wrote :

This would be a good one for 1.0.2 this it causes a lot of hassle for students.

Changed in ivle:
assignee: nobody → David Coles (dcoles)
importance: Low → Medium
milestone: none → 1.0.2
Revision history for this message
Matt Giuca (mgiuca) wrote :

Don't call str.strip -- call rstrip. strip could remove spaces from the front, which could mean wrecking indentation (if the file begins with indents for some reason -- e.g., this should be valid:
____print 4
____print 7
but it would be stripped to:
print 4
____print 7
which is invalid
).

rstrip should be valid, as it would fix the above example.

David Coles (dcoles)
Changed in ivle:
status: Triaged → Fix Committed
William Grant (wgrant)
Changed in ivle:
status: Fix Committed → Fix Released
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.