Re: file open fails.

2009-03-25 Thread John Machin
On Mar 26, 3:06 pm, alex23 wrote: > On Mar 26, 8:05 am, Scott David Daniels wrote: > > > Well, yes in a way, but lots of places in windows you can get a copy > > of a full file spec into the cut buffer, so you cut/paste rather than > > type.  If you do that, you get the backslashes (and you bette

Re: file open fails.

2009-03-25 Thread alex23
On Mar 26, 8:05 am, Scott David Daniels wrote: > Well, yes in a way, but lots of places in windows you can get a copy > of a full file spec into the cut buffer, so you cut/paste rather than > type.  If you do that, you get the backslashes (and you better be > prepared for that by using r'' to past

Re: file open fails.

2009-03-25 Thread Scott David Daniels
afri...@yahoo.co.uk wrote: Wouldn't it be easier just to avoid the windows slashes altogether and stick to the posix: title = 'c:/thesis/refined_title.txt' Well, yes in a way, but lots of places in windows you can get a copy of a full file spec into the cut buffer, so you cut/paste rather than

Re: file open fails.

2009-03-25 Thread afriere
Wouldn't it be easier just to avoid the windows slashes altogether and stick to the posix: title = 'c:/thesis/refined_title.txt' -- http://mail.python.org/mailman/listinfo/python-list

Re: file open fails.

2009-03-24 Thread Rhodri James
On Tue, 24 Mar 2009 22:48:30 -, Wes James wrote: On Tue, Mar 24, 2009 at 4:32 PM, Wes James wrote: \T might mean the same thing as \t (tab), but I thought it would be different... I guess not: http://docs.python.org/reference/lexical_analysis.html#string-literals Wonder why when I d

Re: file open fails.

2009-03-24 Thread Steven D'Aprano
On Tue, 24 Mar 2009 16:48:30 -0600, Wes James wrote: > On Tue, Mar 24, 2009 at 4:32 PM, Wes James wrote: >> On Tue, Mar 24, 2009 at 4:04 PM, Scott David Daniels >> wrote: >>> Atul. wrote: >> >> >> >>> In your case, '\r' is a return (a single character), not two >>> characters long. I think its

Re: file open fails.

2009-03-24 Thread Wes James
On Tue, Mar 24, 2009 at 4:32 PM, Wes James wrote: > On Tue, Mar 24, 2009 at 4:04 PM, Scott David Daniels > wrote: >> Atul. wrote: > > > >> In your case, '\r' is a return (a single character), not two >> characters long. I think its sad that 'C:\Thesis' doesn't cause >> an error because there is

Re: file open fails.

2009-03-24 Thread Wes James
On Tue, Mar 24, 2009 at 4:04 PM, Scott David Daniels wrote: > Atul. wrote: > In your case, '\r' is a return (a single character), not two > characters long. I think its sad that 'C:\Thesis' doesn't cause > an error because there is no such character as '\T', but I am > probably excessively peda

Re: file open fails.

2009-03-24 Thread MRAB
Atul. wrote: Hi I am using IDLE on Windows Vista and I have a small code. title = 'C:\Thesis\refined_title.txt' file = open(title) I get the following error from Python. file = open(title) IOError: [Errno 22] invalid mode ('r') or filename: 'C:\\Thesis \refined_title.txt' Now, I can not

Re: file open fails.

2009-03-24 Thread Scott David Daniels
Atul. wrote: title = 'C:\Thesis\refined_title.txt' file = open(title) I get the following error from Python. file = open(title) IOError: [Errno 22] invalid mode ('r') or filename: 'C:\\Thesis \refined_title.txt' Now, I can not understand the problem here ... Repesat to yourself 1e4 tmes:

file open fails.

2009-03-24 Thread Atul.
Hi I am using IDLE on Windows Vista and I have a small code. title = 'C:\Thesis\refined_title.txt' file = open(title) I get the following error from Python. file = open(title) IOError: [Errno 22] invalid mode ('r') or filename: 'C:\\Thesis \refined_title.txt' Now, I can not understand the