Changeset 9822 in genesis


Ignore:
Timestamp:
Dec 23, 2011, 8:54:51 AM (13 years ago)
Author:
rick
Message:

Make the rdnap parser a bit more robust

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/rdnap.py

    r8872 r9822  
    44# longitude : lam
    55#
     6import os
    67import yaml
    78import urllib
    89
    9 CACHE_FILE = '/tmp/rd2etrs.yaml'
     10try:
     11  CACHE_FILE = os.environ['RD2ETRS_CACHE']
     12except KeyError:
     13  CACHE_FILE = os.path.join(os.environ['HOME'],'.rd2etrs.yaml')
    1014coordinates = None
    1115
     
    1822def write_yaml(gfile, datadump):
    1923  """ Write configuration yaml for 'item'"""
    20   f = open(gfile, 'w')
    21   f.write(yaml.dump(datadump, default_flow_style=False))
    22   f.close()
     24  try:
     25    f = open(gfile, 'w')
     26    f.write(yaml.dump(datadump, default_flow_style=False))
     27    f.close()
     28  except IOError:
     29    pass
    2330
    2431def etrs2rd(lam, phi):
Note: See TracChangeset for help on using the changeset viewer.