Re: [Tutor] getting input for stdin

2014-12-08 Thread Alan Gauld
On 08/12/14 03:50, diliup gabadamudalige wrote: I managed to get the output file and input file working. The output works fine but the input does not. It simply exits the program. No crash. Exits.It DOES NOT WAIT FOR ME TO TYPE IN THE inputfile.txt Can you show us what your input file looks l

Re: [Tutor] getting input for stdin

2014-12-08 Thread Alan Gauld
On 08/12/14 08:14, Alan Gauld wrote: 1.What I want to do is to redirect the output of the program to a text file instead of the standard Python output. That is why I opened the text file. That part of the program works fine. Thats OK, although its still usual to keep a reference to the real s

Re: [Tutor] getting input for stdin

2014-12-08 Thread Alan Gauld
Forwarding tom list Please always use Reply All (or Reply List) to include the list. On 08/12/14 03:19, diliup gabadamudalige wrote: I do not need to save any info in the text files opened for stdout and stdin. The text files are empty files used only for Python output or Input. I only need to

Re: [Tutor] getting input for stdin

2014-12-08 Thread Alan Gauld
Forwarding tom list Please always use Reply All (or Reply List) to include the list. On 08/12/14 03:50, diliup gabadamudalige wrote: I managed to get the output file and input file working. The output works fine but the input does not. It simply exits the program. No crash. Exits.It DOES NOT WA

Re: [Tutor] getting input for stdin

2014-12-08 Thread Alan Gauld
Forwarding tom list Please always use Reply All (or Reply List) to include the list. On 08/12/14 03:11, diliup gabadamudalige wrote: Dear Allen, :) Thank you very much for the responses but some things have been totally misunderstood here. :) 1.What I want to do is to redirect the output o

Re: [Tutor] getting input for stdin

2014-12-07 Thread Alan Gauld
On 07/12/14 17:38, diliup gabadamudalige wrote: if __name__ == '__main__': You don't really need that unless your code can be treated as a module, which yours can't. p = os.getcwd() filename = "\get scale of choice.txt" filepath = p + filename sys.stdout = open(filepath,

Re: [Tutor] getting input for stdin

2014-12-07 Thread Danny Yoo
> I need to get the stdin input from the text I type into the same text file > that I have stdout at. How do I do that. None of the answers at > stackoverflow got me going. Any help on a code snippet would be appreciated. In-place edits of a file are dangerous, especially as a beginner. This is be

[Tutor] getting input for stdin

2014-12-07 Thread diliup gabadamudalige
Dear alll, my code is given below if __name__ == '__main__': p = os.getcwd() filename = "\get scale of choice.txt" filepath = p + filename sys.stdout = open(filepath, "w") os.startfile(filepath) for i in data.info: # print all the scale info to window print i