PRS505/700: Dont fail to detect the device if SD card is buggy

This commit is contained in:
Kovid Goyal 2009-02-10 10:40:47 -08:00
parent bc4b6fdf48
commit 83bc5c8096

View File

@ -248,15 +248,20 @@ class PRS505(Device):
time.sleep(3) time.sleep(3)
self.open_osx() self.open_osx()
if self._card_prefix is not None: if self._card_prefix is not None:
cachep = os.path.join(self._card_prefix, self.CACHE_XML) try:
if not os.path.exists(cachep): cachep = os.path.join(self._card_prefix, self.CACHE_XML)
os.makedirs(os.path.dirname(cachep), mode=0777) if not os.path.exists(cachep):
f = open(cachep, 'wb') os.makedirs(os.path.dirname(cachep), mode=0777)
f.write(u'''<?xml version="1.0" encoding="UTF-8"?> f = open(cachep, 'wb')
f.write(u'''<?xml version="1.0" encoding="UTF-8"?>
<cache xmlns="http://www.kinoma.com/FskCache/1"> <cache xmlns="http://www.kinoma.com/FskCache/1">
</cache> </cache>
'''.encode('utf8')) '''.encode('utf8'))
f.close() f.close()
except:
self._card_prefix = None
import traceback
traceback.print_exc()
def set_progress_reporter(self, pr): def set_progress_reporter(self, pr):
self.report_progress = pr self.report_progress = pr