Message146024
http://docs.python.org/library/os.html#os.access
points out that I should use
try:
fp = open("myfile")
except IOError as e:
if e.errno == errno.EACCESS:
return "some default data"
# Not a permission error.
raise
else:
with fp:
return fp.read()
but theres a typo the correct is errno.EACCES: not errno.EACCESS: |
|
Date |
User |
Action |
Args |
2011-10-20 16:20:41 | Guilherme.Moro | set | recipients:
+ Guilherme.Moro, docs@python |
2011-10-20 16:20:40 | Guilherme.Moro | set | messageid: <1319127640.96.0.83884717457.issue13233@psf.upfronthosting.co.za> |
2011-10-20 16:20:40 | Guilherme.Moro | link | issue13233 messages |
2011-10-20 16:20:40 | Guilherme.Moro | create | |
|