logo       

[jira] Commented: (BOO-497) Unexpected streamwriter stop: msg#00100

lang.boo.devel

Subject: [jira] Commented: (BOO-497) Unexpected streamwriter stop

[ http://jira.codehaus.org/browse/BOO-497?page=comments#action_47221 ]

Doug Holton commented on BOO-497:
---------------------------------

There is a conflict between writing to the file and writing to console or
waiting for console input. I'm not sure of the exact reason for this, but if
you close the text stream, your code will work. (call str.Close()).

Here's your code using string.Format, too for number formatting if it is of
help:

import System
import System.IO
str = StreamWriter("dl2.txt")
for i in range(110):
str.WriteLine(string.Format("somethingSomething{0:000}.jpg", i))
print i
str.Close()

/*
another way: "using" will close it for you
using str = StreamWriter("dl2.txt"):
for i in range(110):
str.WriteLine(string.Format("somethingSomething{0:000}.jpg", i))
print i
*/

print "Enter"
gets()

> Unexpected streamwriter stop
> ----------------------------
>
> Key: BOO-497
> URL: http://jira.codehaus.org/browse/BOO-497
> Project: Boo
> Type: Bug
> Environment: Windows XP, .NET Framework 1.1
> Reporter: Pendowski Jaroslaw
> Priority: Critical
> Attachments: loopstop.zip
>
>
> I wanted to generate links to about 80 jpg's - so I user boo.
> I've made small script and run it.
> It used StreamWriter, one loop and one if.
> The loop started from 0 and ended on 79 but in generated file links stoped on
> some part of 69th line
> I attach the script (boodl.txt) and result (dl2.txt)

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise