old_contents: import urlparse
  import os, sys, re, random,pybitcointools, bitcoinrpc, math
  from decimal import Decimal
  from flask import Flask, request, jsonify, abort, json, make_response
  from msc_apps import *
  tools_dir = os.environ.get('TOOLSDIR')
  lib_path = os.path.abspath(tools_dir)
  sys.path.append(lib_path)
  data_dir_root = os.environ.get('DATADIR')
  
  sys.path.append("/usr/lib/armory/")
  from armoryengine.ALL import *
  
  app = Flask(__name__)
  app.debug = True
  
  
  @app.route('/getunsigned', methods=['POST'])
  def generate_unsigned():
      unsigned_hex = request.form['unsigned_hex']
      pubkey = request.form['pubkey']
      #Translate raw txn
      pytx = PyTx()
      print("Encoding raw txn: %s" % unsigned_hex)
      try:
          unsigned_tx_bin = hex_to_binary(unsigned_tx_hex)
          pytx = PyTx().unserialize(unsigned_tx_bin)
          utx = UnsignedTransaction(pytx=pytx, pubKeyMap=hex_to_binary(public_key_hex))
          unsigned_tx_ascii = utx.serializeAscii()
      except Exception, e:
          return jsonify({"status": 502, "error":"Error serializing transaction: %s" % e)
  
      print("\n\nOutput is:\n%s" % unsigned_tx_ascii)  
      return jsonify({'armoryUnsigned':unsigned_tx_ascii})  
new_contents: import urlparse
  import os, sys, re, random,pybitcointools, bitcoinrpc, math
  from decimal import Decimal
  from flask import Flask, request, jsonify, abort, json, make_response
  from msc_apps import *
  tools_dir = os.environ.get('TOOLSDIR')
  lib_path = os.path.abspath(tools_dir)
  sys.path.append(lib_path)
  data_dir_root = os.environ.get('DATADIR')
  
  sys.path.append("/usr/lib/armory/")
  from armoryengine.ALL import *
  
  app = Flask(__name__)
  app.debug = True
  
  
  @app.route('/getunsigned', methods=['POST'])
  def generate_unsigned():
      unsigned_hex = request.form['unsigned_hex']
      pubkey = request.form['pubkey']
      #Translate raw txn
      pytx = PyTx()
      print("Encoding raw txn: %s" % unsigned_hex)
      try:
          unsigned_tx_bin = hex_to_binary(unsigned_hex)
          pytx = PyTx().unserialize(unsigned_tx_bin)
          utx = UnsignedTransaction(pytx=pytx, pubKeyMap=hex_to_binary(pubkey))
          unsigned_tx_ascii = utx.serializeAscii()
      except Exception, e:
          print("Error serializing transaction: %s" % e)
          abort(500)
  
      print("\n\nOutput is:\n%s" % unsigned_tx_ascii)  
      return jsonify({'armoryUnsigned':unsigned_tx_ascii})  
subject: Fix variable naming