import os
import cPickle as pickle

try: DATA_DIR = os.path.dirname(os.path.realpath(__file__))
except: DATA_DIR = os.getcwd()


cache_path = lambda name: os.path.join(DATA_DIR, '%s.cache' % name)

def get_cache(name):
    return pickle.load(open(cache_path(name), 'r'))
    
def save_cache(obj, name):
    pickle.dump(obj, open(cache_path(name), 'w'), protocol=-1)

import os
import cPickle as pickle


home_dir = os.path.expanduser('~')
DATA_DIR = os.path.join(home_dir, '.tax_resolve')
if not os.path.exists(DATA_DIR):
    try:
        os.mkdir(DATA_DIR)
    except: DATA_DIR = os.getcwd()

cache_path = lambda name: os.path.join(DATA_DIR, '%s.cache' % name)

def get_cache(name):
    return pickle.load(open(cache_path(name), 'r'))
    
def save_cache(obj, name):
    pickle.dump(obj, open(cache_path(name), 'w'), protocol=-1)

Use user's local application data directory instead of the module path.
Use user's local application data directory instead of the module path.

  import os
  import cPickle as pickle
  
- try: DATA_DIR = os.path.dirname(os.path.realpath(__file__))
- except: DATA_DIR = os.getcwd()
  
+ home_dir = os.path.expanduser('~')
+ DATA_DIR = os.path.join(home_dir, '.tax_resolve')
+ if not os.path.exists(DATA_DIR):
+     try:
+         os.mkdir(DATA_DIR)
+     except: DATA_DIR = os.getcwd()
  
  cache_path = lambda name: os.path.join(DATA_DIR, '%s.cache' % name)
  
  def get_cache(name):
      return pickle.load(open(cache_path(name), 'r'))
      
  def save_cache(obj, name):
      pickle.dump(obj, open(cache_path(name), 'w'), protocol=-1)
  
Use user's local application data directory instead of the module path.
## Code Before:
import os
import cPickle as pickle

try: DATA_DIR = os.path.dirname(os.path.realpath(__file__))
except: DATA_DIR = os.getcwd()


cache_path = lambda name: os.path.join(DATA_DIR, '%s.cache' % name)

def get_cache(name):
    return pickle.load(open(cache_path(name), 'r'))
    
def save_cache(obj, name):
    pickle.dump(obj, open(cache_path(name), 'w'), protocol=-1)

## Instruction:
Use user's local application data directory instead of the module path.
## Code After:
import os
import cPickle as pickle


home_dir = os.path.expanduser('~')
DATA_DIR = os.path.join(home_dir, '.tax_resolve')
if not os.path.exists(DATA_DIR):
    try:
        os.mkdir(DATA_DIR)
    except: DATA_DIR = os.getcwd()

cache_path = lambda name: os.path.join(DATA_DIR, '%s.cache' % name)

def get_cache(name):
    return pickle.load(open(cache_path(name), 'r'))
    
def save_cache(obj, name):
    pickle.dump(obj, open(cache_path(name), 'w'), protocol=-1)
