#!/usr/bin/python # -*- coding: utf-8 -*- import os from subprocess import Popen, PIPE def solveIt(inputData): process = Popen(['nqueens.exe', str(inputData)], stdout=PIPE) (stdout, stderr) = process.communicate() return stdout.strip() import sys if __name__ == "__main__": if len(sys.argv) > 1: try: n = int(sys.argv[1].strip()) except: print sys.argv[1].strip(), 'is not an integer' print 'Solving Size:', n print(solveIt(n)) else: print('This test requires an instance size. Please select the size of problem to solve. (i.e. python queensSolver.py 8)')