[Tutor] Can't figure out why this is printing twice

Wayne srilyk at gmail.com
Mon Jun 8 17:26:06 CEST 2009


On Mon, Jun 8, 2009 at 10:07 AM, The Green Tea Leaf <
thegreentealeaf at gmail.com> wrote:

> Could it be some import statement? That the gzip file is "shadowed" in some
> way?


based on what the OP said, there's really nothing that should produce that
that I can think of that would produce the given output! I'd love to see a
screenshot, though. Because it's printing the string twice - not the date.

If it were a problem with the date or gzip you would think you'd get
problems with something unrelated to the string. The only thing I can think
of is if his stack/heap is somehow getting altered from outside python (or
inside, I suppose)

So Mike, can you provide a screenshot of your code/execution? Sending it
directly (at least to me) will prevent it getting delayed while the
attachment is approved.

-Wayne


>
> On Mon, Jun 8, 2009 at 16:11, Alan Gauld<alan.gauld at btinternet.com> wrote:
> >
> > "Mike Hoy" <hoym74 at gmail.com> wrote
> >
> >
> >> I have the following code:
> >
> > Is this in a file or are you typing it at the python
> > interpreter >>> primpt?
> >
> >> import gzip
> >> import datetime
> >> date = datetime.date.today()
> >> name = date.strftime('%m-%d-%Y')+'.gz'
> >> date.strftime('%m-%d-%Y')+'.gz'
> >> print "The name of the file will be", name
> >
> > If its in a file you should only get one print
> > If its at the >>> prompt you should get a string after
> > the second call to date.strftime and then your print.
> >
> >> the output is:
> >> The name of the file will be
> >> The name of the file will be 06-08-2009.gz
> >> I can't figure out why 'The name of the file will be' is printing twice.
> >> Any
> >> help appreciated.
> >
> > If that is what you get then me neither!
> >
> > Alan G.
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
>
> --
> The Green Tea Leaf   thegreentealeaf at gmail.com
> thegreentealeaf.blogspot.com
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn’t. - Primo Levi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090608/c3032d62/attachment.htm>


More information about the Tutor mailing list