If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

In that, see where rea = raw_input("Really remove %s? (y/n): " % rem) is? When I try to stimulate the 256 error, it tells me that the command I tried to input does not exist (an error message I put in my code)

So it processes my "y" as com == "y", I think.
Where is it wrong?
Above shows what happens, at '>>>' if I typed something that is not a command that error would've shown.

I don't know. But trying to remove a directory using part of your code gives me:

Code:

errno = 21 # not 256
strerror = "Is a directory"

For development purposes, it might be a good idea to include a catch-all "else" in your except block and print out errno and strerror. This is for finding out the correct error codes for different things:

Code:

except OSError as (errno, strerror):
if errno == 21:
# What you want to say/do when trying to delete a directory.
print strerror
elif errno == 2:
# What you want to say/do when deleting a non-existent file.
print strerror
else:
# So you can find out what error codes are being returned for
# for stuff you don't know about yet.
print errno, strerror