Sorry David<br><br>The correctly indented code with the while loop is <br><br><br>while friday.weekday() != calendar.MONDAY:<br>       MONDAY -= oneday<br><br>oneweek = datetime.timedelta(days=7)<br><br>nextweek = today + oneweek<br>
<br>nextyear = today.replace(year=today.year+1)<br><br>print &quot;Today (year-month-day) =&quot;, today<br> <br>print &quot;Most recent Monday =&quot;, monday<br><br><br><br><br>Is there any change in the calendar module from Python 2.6 to 2.7.<br>
<br>This example works fine in Python 2.6 but throws up an error in 2.7<br><br><br><div class="gmail_quote">On Sat, Mar 5, 2011 at 12:58 PM, David Hutto <span dir="ltr">&lt;<a href="mailto:smokefloat@gmail.com">smokefloat@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Could you paste the whle code, because I get:<br>
<div class="im"><br>
&gt;&gt;&gt; import datetime<br>
&gt;&gt;&gt; import calendar<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; while monday.weekday() != calendar.MONDAY:<br>
</div>...<br>
  File &quot;&lt;stdin&gt;&quot;, line 2<br>
<br>
    ^<br>
IndentationError: expected an indented block<br>
&gt;&gt;&gt;     monday -= oneday<br>
  File &quot;&lt;stdin&gt;&quot;, line 1<br>
    monday -= oneday<br>
    ^<br>
IndentationError: unexpected indent<br>
<div class="im">&gt;&gt;&gt;<br>
&gt;&gt;&gt; oneweek = datetime.timedelta(days=7)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; nextweek = today + oneweek<br>
</div><div class="im">Traceback (most recent call last):<br>
</div>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
NameError: name &#39;today&#39; is not defined<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; print next week<br>
</blockquote></div><br><br clear="all"><br>-- <br>The inherent vice of capitalism is the unequal sharing of blessings; the inherent virtue of socialism is the equal sharing of miseries. <br><br>~ Winston Churchill<br>