Re: Calling external text-files (newb)

2005-02-28 Thread Peter Hansen
Andreas Winkler wrote: I tried to have python call an external 'Word'-file, and the read the whole text into a single string with the following code: [CODE] source = raw_input('file path') File = open('source', 'r') S = input.read() print S [/CODE] Anything inside quotation marks is just a string o

Re: Calling external text-files (newb)

2005-02-28 Thread Michael Hartl
There are two problems: (1) by quoting 'source', you refer to a string literal, not the variable you defined via raw_input; (2) you have not defined the variable 'input', so there's no way to call the 'read' method on it. Try this instead: source_path = raw_input('file path: ') s = open(source_pa

Re: Calling external text-files (newb)

2005-02-28 Thread Michael Hartl
There are two problems: (1) by quoting 'source', you refer to a string literal, not the variable you defined via raw_input; (2) you have not defined the variable 'input', so there's no way to call the 'read' method on it. Try this instead: source_path = raw_input('file path: ') s = open(source_pa

Calling external text-files (newb)

2005-02-28 Thread Andreas Winkler
Hi I tried to have python call an external 'Word'-file, and the read the whole text into a single string with the following code: [CODE] source = raw_input('file path') File = open('source', 'r') S = input.read() print S [/CODE] But when I try to run it, it raises the following error: File = op