Re: [Tutor] Equivalent exception of os.path.exists()

2009-12-01 Thread spir
bibi midi dixit: > Like i thought so, there is no exception to catch if a file already exist. > I've been browsing the many types of exceptions and cant find anything thats > close. Thank you for clarifying. > Actually, you can. I guess it's not the book author's intent, but you can try it for

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread bibi midi
Thanks to all of you that replied. Your inputs are very helpful and informative. On Tue, Dec 1, 2009 at 12:14 AM, Sander Sweers wrote: > > There is no exception to alert you a file already exists. Depending on > how you open the file (mode) it will either read, write or append to > the file. If

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread Alan Gauld
"Dave Angel" wrote My suspicion is that the author just wants you to try to do an open() (readonly), inside a try/except block, and to successfully handle the exception. And the critical thing here is that it must be an open in read mode. As others pointed out if you use write mode it wi

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread christopher . henk
biboy mendz wrote on 11/30/2009 03:04:52 PM: > > > spir wrote: > > > > What is your question? > > If it's about the type of exception raised when os.path.exists fails, well, sure it's hard to find: > > > > print os.path.exists("foo".bar) > > ==> False > > > > > My question is: i'm looking

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread spir
biboy mendz dixit: > > > spir wrote: > > > > What is your question? > > If it's about the type of exception raised when os.path.exists fails, well, > > sure it's hard to find: > > > > print os.path.exists("foo".bar) > > ==> False > > > > > My question is: i'm looking for type of excepti

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread Sander Sweers
2009/11/30 biboy mendz : > clause, it should be on the fobj-open line. But im still looking for the > exception that will be raised when i input a filename and that file already > exists. I hope you get what i mean :-) There is no exception to alert you a file already exists. Depending on how you

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread Dave Angel
spir wrote: biboy mendz dixit: http://pastebin.ca/1693849 This is end-of-chapter3 exercise of the book Core Python Programming. I'm reading/searching in the book and other materials but is unsuccessful. There are at least 50 exceptions listed but I can't find anything close. I comment

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread Tim Golden
biboy mendz wrote: Lie and Tim's input are true that raw_input doesnt do anything or you cant catch exception error from it. And i'm wrong in placing the try-except clause, it should be on the fobj-open line. But im still looking for the exception that will be raised when i input a filename an

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread biboy mendz
spir wrote: What is your question? If it's about the type of exception raised when os.path.exists fails, well, sure it's hard to find: print os.path.exists("foo".bar) ==> False My question is: i'm looking for type of exception that more or less equivalent to os.path.exists attribute

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread spir
biboy mendz dixit: > http://pastebin.ca/1693849 > > This is end-of-chapter3 exercise of the book Core Python Programming. > > I'm reading/searching in the book and other materials but is > unsuccessful. There are at least 50 exceptions listed but I can't find > anything close. > > I commente

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread Lie Ryan
On 12/1/2009 12:00 AM, biboy mendz wrote: http://pastebin.ca/1693849 This is end-of-chapter3 exercise of the book Core Python Programming. I'm reading/searching in the book and other materials but is unsuccessful. There are at least 50 exceptions listed but I can't find anything close. I comme

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread Tim Golden
biboy mendz wrote: http://pastebin.ca/1693849 This is end-of-chapter3 exercise of the book Core Python Programming. I'm reading/searching in the book and other materials but is unsuccessful. There are at least 50 exceptions listed but I can't find anything close. I commented out my modified