diff options
| author | Ivan Veselov <veselov@gmail.com> | 2018-10-14 16:53:07 +0100 |
|---|---|---|
| committer | Ivan Veselov <veselov@gmail.com> | 2018-10-14 16:53:07 +0100 |
| commit | 724e763db5309861aa4cc61d8e965af3f3c63f51 (patch) | |
| tree | 396b9e99fabe0ab3ef9a506c9c8f58f659bdc17a | |
| parent | 249588acd5dddafcd0ae33a0ae6dfc5431dea4bc (diff) | |
| download | PROJ-724e763db5309861aa4cc61d8e965af3f3c63f51.tar.gz PROJ-724e763db5309861aa4cc61d8e965af3f3c63f51.zip | |
Make plot.py error message more helpful
| -rw-r--r-- | docs/plot/plot.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/plot/plot.py b/docs/plot/plot.py index 139281bf..a4f330f6 100644 --- a/docs/plot/plot.py +++ b/docs/plot/plot.py @@ -157,8 +157,14 @@ def project(coordinates, proj_string, in_radians=False): args = [PROJ, '-b'] args.extend(proj_string.split(' ')) - proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - env={'PROJ_LIB': os.path.abspath(PROJ_LIB)}) + try: + proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + env={'PROJ_LIB': os.path.abspath(PROJ_LIB)}) + except FileNotFoundError: + print("'proj' binary not found, please update PROJ constant in plot.py " + "to point to your local 'proj' binary") + exit(1) + stdout, _ = proc.communicate(coordinates.tobytes(order='C')) out = np.frombuffer(stdout, dtype=np.double) @@ -304,7 +310,7 @@ def plotproj(plotdef, data, outdir): # Make sure the plot is not stretched axes.set_aspect('equal') - + if not os.path.exists(outdir): os.makedirs(outdir) plt.savefig(outdir + '/' + plotdef['filename'], |
