| 237 | |
| 238 | @classmethod |
| 239 | def _load_data(klass, name): |
| 240 | filename = '%s.pickle.gz' % name |
| 241 | if klass.debug: |
| 242 | print >>sys.stderr, 'loading:', name |
| 243 | default_path = os.environ.get('CMAP_PATH', '/usr/share/pdfminer/') |
| 244 | for directory in (os.path.dirname(cmap.__file__), default_path): |
| 245 | path = os.path.join(directory, filename) |
| 246 | if os.path.exists(path): |
| 247 | gzfile = gzip.open(path) |
| 248 | try: |
| 249 | return type(name, (), pickle.loads(gzfile.read())) |
| 250 | finally: |
| 251 | gzfile.close() |
| 252 | else: |
| 253 | raise CMapDB.CMapNotFound(name) |
| 254 | |
| 255 | @classmethod |
| 256 | def get_cmap(klass, name): |