<div dir="ltr"><div dir="ltr"><div>What is probably happening is that cron is skipping your normal shell startup script such as .cshrc or .bashrc.  This is normal cron behavior.  If your normal startup script sets $PATH or an alias affecting NCL, and is skipped, then your cron job may find an older version in a system default path such as /usr/bin.</div><div><br></div><div>At the start of your cron job, add an environment command like "setenv PATH", or possibly invoke your normal startup script, to get your expected NCL environment.  This is also probably the right place to set NCARG_ROOT, to reduce hard coded dependencies in your application code.</div><div><br></div><div>Here is an article with more details.  See the first paragraph under "Notes and warnings" near the bottom.</div><div><br></div><div><a href="https://drupal.star.bnl.gov/STAR/blog/jeromel/2013/apr/05/how-setup-crontabs">https://drupal.star.bnl.gov/STAR/blog/jeromel/2013/apr/05/how-setup-crontabs</a><br></div><div><br></div><div><br></div><div>On Wed, Jul 22, 2020 at 4:21 PM Diana Stovern - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello all, <div><br></div><div>Has anyone ever had issues running NCL on a cron via a python script?  For example, I wrote a python script that calls a bunch of NCL scripts using the os.system command (i.e., os.system('ncl ' + regrid_script.ncl).  I define the NCARG_ROOT environment in the python script like the help forums on this topic suggest with the following code: <div><br></div><div>os.environ["NCARG_ROOT"]='/usr/local/ncl-6.6.2'</div></div><div><br></div><div>

Running the python script from the terminal always invokes NCL 6.6.2.  However, the NCL version that is invoked from the cron is a really old version (6.3.0).  I recently had 6.6.2 installed so I could take advantage of the ESMF regridding routines.  </div><div><br></div><div>My question is, does anyone know why the cron invokes the old version of NCL and not the new version specified in the python script?  This is really causing problems because the python script tries to run the NCL scripts with version 6.3.0, but looking in directories associated with 6.6.2, thus errors arise and the script crashes.   </div><div><br></div><div>Has anyone experienced this issue before and have a quick fix?  How do I get the cron to invoke 6.6.2 instead of 6.3.0?   </div><div><br></div><div>Any advice is greatly appreciated!  </div><div><br></div><div>- Diana Stovern</div></div></blockquote></div></div></div>