<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python 3 runtime ArcGIS Server Linux Crontab in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134622#M10552</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have done a lot of great troubleshooting work, and have narrowed down the issue enough that I would reach out to Esri Support.&amp;nbsp; Although there is a chance a GeoNet user might have some good suggestions or feedback for you, you will probably get better feedback at this point by going through Support.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Jun 2020 14:49:45 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2020-06-25T14:49:45Z</dc:date>
    <item>
      <title>Python 3 runtime ArcGIS Server Linux Crontab</title>
      <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134621#M10551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’m hoping someone can shed some light on a problem I’ve been wrestling with. I have been unable get the Python 3 runtime for ArcGIS Server 10.7.1 on Linux running through a crontab job and wanted to see if anyone else has achieved what I am trying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a bash shell script (cron_test.sh) running on Ubuntu 18.04.2 that runs the following commands:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;export ARCGISHOME=/arcgis/server&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;. /home/arcgis/anaconda3/etc/profile.d/conda.sh&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;conda activate python36b&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;python /home/arcgis/arcgis-imagery/Geoplex/cron_test.py&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;/P&gt;&lt;P&gt;and the cron_test.py script is only creating a file GDB:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;import sys&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;import os&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;import arcpy&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;import datetime&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;import tempfile&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;import logging&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;TEMPDIR = tempfile.mkdtemp()&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;fgdb_name = "test.gdb"&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;fgdb_path = os.path.join(TEMPDIR, fgdb_name)&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;logging_level = logging.INFO&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;log_dir = '/tmp/logs'&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;now = datetime.datetime.strftime(datetime.datetime.now(), "%Y_%m_%d_%H_%M_%S")&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;logfile_name = "test" + '_' + now + '.log'&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;logging.basicConfig(filename=os.path.join(log_dir, logfile_name), level=logging_level)&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;for a in os.environ:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.info('Var: ' + str(a) + ' Value: ' + str(os.getenv(a)))&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;logging.info(f"\tCreating file geodatabase in {TEMPDIR}, called {fgdb_name}")&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;arcpy.CreateFileGDB_management(TEMPDIR, fgdb_name)&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;logging.info(f"\tCreated file geodatabase in {TEMPDIR}, called {fgdb_name}")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I sudo into the arcgis user interactively and then run the shell script with the command:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;Bash /path/to/cron_test.sh&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&lt;/P&gt;&lt;P&gt;The script runs and creates the file GDB fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;INFO:root:Var: CONDA_SHLVL Value: 2&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LD_LIBRARY_PATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb/lib:/arcgis/server/bin/wine/lib64:/arcgis/server/bin/wine/lib64/wine:/arcgis/server/bin/wine/lib64/wine/supp:/arcgis/server/framework/runtime/tomcat/bin:/arcgis/server/lib:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LIBGL_DRIVERS_PATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb/lib/dri&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LS_COLORS Value: rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_EXE Value: /home/arcgis/anaconda3/bin/conda&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: FONTCONFIG_PATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb/etc/fonts&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: XVFBPATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LESSCLOSE Value: /usr/bin/lesspipe %s %s&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SDEHOME Value: /arcgis/server&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LANG Value: C.UTF-8&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: AGS_ORIG_PATH Value: /arcgis/server/bin:/home/arcgis/anaconda3/envs/python36b/bin:/home/arcgis/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SUDO_GID Value: 1000&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: OLDPWD Value: /home/arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: WINEPATH Value: /arcgis/server/bin/wine&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: AGSSERVER Value: /arcgis/server/&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: USERNAME Value: root&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_PREFIX Value: /home/arcgis/anaconda3/envs/python36b&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SUDO_COMMAND Value: /bin/su arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: _CE_M Value:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CLASSPATH Value: /arcgis/server/framework/lib/arcobjects.jar:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: USER Value: arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_PREFIX_1 Value: /home/arcgis/anaconda3&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: arcgis_cloud_platform Value: aws&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: PWD Value: /tmp/logs&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: HOME Value: /home/arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_PYTHON_EXE Value: /home/arcgis/anaconda3/bin/python&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SUDO_USER Value: ubuntu&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: ARCGISHOME Value: /arcgis/server&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: _CE_CONDA Value:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: WINEDEBUG Value: -all&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: TOMCATBIN Value: /arcgis/server/framework/runtime/tomcat/bin&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_PROMPT_MODIFIER Value: (python36b)&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SUDO_UID Value: 1000&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: MAIL Value: /var/mail/arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: ARCGIS_JAVA_HOME Value: /arcgis/server//framework/runtime/jre/&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: TERM Value: xterm&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SHELL Value: /bin/bash&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: FONTCONFIG_FILE Value: /arcgis/server/framework/runtime/xvfb/Xvfb/etc/fonts/fonts.conf&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SHLVL Value: 2&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: AGS_ORIG_LD_LIBRARY_PATH Value: /arcgis/server/lib:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LOGNAME Value: arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: DOTWINE Value: /arcgis/server/framework/runtime/.wine&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: PATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb/bin:/arcgis/server/bin/wine/bin:/arcgis/server//framework/runtime/jre//bin:/arcgis/server/framework/runtime/ArcGIS/Resources/ArcToolBox/Scripts:/arcgis/server/framework/runtime/ArcGIS/bin:/arcgis/server/bin:/home/arcgis/anaconda3/envs/python36b/bin:/home/arcgis/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_DEFAULT_ENV Value: python36b&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: HOMEPATH Value: /home/arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: ENGINEJAVA94 Value: /arcgis/server/&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: WINEPREFIX Value: /arcgis/server/framework/runtime/.wine&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LESSOPEN Value: | /usr/bin/lesspipe %s&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: _ Value: /home/arcgis/anaconda3/envs/python36b/bin/python&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Creating file geodatabase in /tmp/tmp8dp6qygo, called test.gdb&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Created file geodatabase in /tmp/tmp8dp6qygo, called test.gdb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The geodatabase is created fine and can be viewed. The environment variables are logged for the purpose of the next step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to run an arcpy script periodically, so I have tried to call the bash script by adding it to crontab. This is where the problem starts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I add the bash command to the arcgis user crontab file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * * * * * bash /path/to/cron_test.sh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the script runs it can import the arcpy library but when it gets to the CreateFileGDB command the script hangs and it doesn’t create the file GDB, no errors reported either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INFO:root:Var: CONDA_SHLVL Value: 1&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LD_LIBRARY_PATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb/lib:/arcgis/server/bin/wine/lib64:/arcgis/server/bin/wine/lib64/wine:/arcgis/server/bin/wine/lib64/wine/supp:/arcgis/server/framework/runtime/tomcat/bin:/arcgis/server/lib:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LIBGL_DRIVERS_PATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb/lib/dri&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_EXE Value: /home/arcgis/anaconda3/bin/conda&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: FONTCONFIG_PATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb/etc/fonts&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: XVFBPATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SDEHOME Value: /arcgis/server&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LANG Value: C.UTF-8&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: AGS_ORIG_PATH Value: /arcgis/server/bin:/home/arcgis/anaconda3/envs/python36b/bin:/home/arcgis/anaconda3/condabin:/usr/bin:/bin&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: WINEPATH Value: /arcgis/server/bin/wine&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: AGSSERVER Value: /arcgis/server/&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_PREFIX Value: /home/arcgis/anaconda3/envs/python36b&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: _CE_M Value:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CLASSPATH Value: /arcgis/server/framework/lib/arcobjects.jar:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: arcgis_cloud_platform Value: aws&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: PWD Value: /home/arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: HOME Value: /home/arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_PYTHON_EXE Value: /home/arcgis/anaconda3/bin/python&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: ARCGISHOME Value: /arcgis/server&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: _CE_CONDA Value:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: WINEDEBUG Value: -all&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: TOMCATBIN Value: /arcgis/server/framework/runtime/tomcat/bin&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_PROMPT_MODIFIER Value: (python36b)&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: ARCGIS_JAVA_HOME Value: /arcgis/server//framework/runtime/jre/&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SHELL Value: /bin/sh&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: FONTCONFIG_FILE Value: /arcgis/server/framework/runtime/xvfb/Xvfb/etc/fonts/fonts.conf&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: SHLVL Value: 1&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: AGS_ORIG_LD_LIBRARY_PATH Value: /arcgis/server/lib:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: LOGNAME Value: arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: DOTWINE Value: /arcgis/server/framework/runtime/.wine&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: PATH Value: /arcgis/server/framework/runtime/xvfb/Xvfb/bin:/arcgis/server/bin/wine/bin:/arcgis/server//framework/runtime/jre//bin:/arcgis/server/framework/runtime/ArcGIS/Resources/ArcToolBox/Scripts:/arcgis/server/framework/runtime/ArcGIS/bin:/arcgis/server/bin:/home/arcgis/anaconda3/envs/python36b/bin:/home/arcgis/anaconda3/condabin:/usr/bin:/bin&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: CONDA_DEFAULT_ENV Value: python36b&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: HOMEPATH Value: /home/arcgis&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: ENGINEJAVA94 Value: /arcgis/server/&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: WINEPREFIX Value: /arcgis/server/framework/runtime/.wine&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:Var: _ Value: /home/arcgis/anaconda3/envs/python36b/bin/python&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;INFO:root:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Creating file geodatabase in /tmp/tmpu2gxq8jy, called test.gdb&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;&lt;/P&gt;&lt;P&gt;When crontab runs the command there are less variables coming through to the python script, but I have tried manually set them in the bash shell script with export commands so they are identical to the manual run and I still get the same result. This suggests the is more than setting environment variables that is preventing the arcpy commands from running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other things I have tried is running the shell commands directly in crontab job like:&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;SHELL=/bin/bash&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;BASH_ENV=/home/arcgis/anaconda3/etc/profile.d/conda.sh&lt;/P&gt;&lt;P style="margin-left: 36.0pt;"&gt;* * * * * export ARCGISHOME=/arcgis/server; conda activate python36b; python /home/arcgis/arcgis-imagery/Geoplex/cron_test.py&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’ve tried loading the profile and bashrc files into the bash script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . /home/arcgis/.profile&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . /home/arcgis/.bashrc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’ve taken out everything except the import arcpy and createFileGDB command in the python script, and also I’ve tried using the fish shell in place of bash, all to no avail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the behavior I’m getting can someone point me to how to troubleshoot this further? It would be greatly appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anaconda version&amp;nbsp;Anaconda3-2020.02-Linux-x86_64&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Leon.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2020 06:26:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134621#M10551</guid>
      <dc:creator>LeonAus</dc:creator>
      <dc:date>2020-06-25T06:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python 3 runtime ArcGIS Server Linux Crontab</title>
      <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134622#M10552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have done a lot of great troubleshooting work, and have narrowed down the issue enough that I would reach out to Esri Support.&amp;nbsp; Although there is a chance a GeoNet user might have some good suggestions or feedback for you, you will probably get better feedback at this point by going through Support.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2020 14:49:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134622#M10552</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-06-25T14:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python 3 runtime ArcGIS Server Linux Crontab</title>
      <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134623#M10553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Leon - did you ever get any support from Esri on this? I have also run into exactly the same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By sending the standard and error output from my cron job to a&amp;nbsp;text file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;* * * * * conda activate &lt;SPAN&gt;/home/arcgis/envs;&amp;nbsp;&lt;/SPAN&gt;python /home/arcgis/my_test.py &amp;gt;&amp;gt; /home/arcgis/cron_test.txt 2&amp;gt;&amp;amp;1&lt;/P&gt;&lt;P&gt;I was able to get this additional error message which seems to happen when the first call to arcpy is made:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Fatal Python error: Py_Initialize: can't initialize sys standard streams&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;OSError: [WinError 6] Invalid handle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Current thread 0x0000024c (most recent call first):&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Aug 2020 00:47:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134623#M10553</guid>
      <dc:creator>SiCasley</dc:creator>
      <dc:date>2020-08-28T00:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python 3 runtime ArcGIS Server Linux Crontab</title>
      <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134624#M10554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We're working with Esri (Canada) support on this... possibly an issue with Wine. Still no resolution for 10.7.1, but looks like the issue is fixed with 10.8.1 Python 3 runtime.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2020 16:29:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/134624#M10554</guid>
      <dc:creator>SiCasley</dc:creator>
      <dc:date>2020-10-16T16:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Python 3 runtime ArcGIS Server Linux Crontab</title>
      <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/1040892#M60575</link>
      <description>&lt;P&gt;Simon, thanks for following up on this. I am back on the project that I ran into this problem with and I can confirm with 10.8.1 I am able to create a new file geodatabase through a crontab job.&lt;BR /&gt;&lt;BR /&gt;Unfortunately there are a few ArcGIS objects that my script needs to create and I had hoped that the fix for the geodatabase would have fixed all creating commands but I'm unable to create a raster mosaic inside the gdb, or create a cloud storage connection file. Looks like I'll be going back to handing off those tasks to a geoprocessing service.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 23:49:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/1040892#M60575</guid>
      <dc:creator>LeonAus</dc:creator>
      <dc:date>2021-03-25T23:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python 3 runtime ArcGIS Server Linux Crontab</title>
      <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/1248247#M66563</link>
      <description>&lt;P&gt;I'm experiencing this exact issue on v10.9.1. Did you ever find a resolution?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 22:08:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/1248247#M66563</guid>
      <dc:creator>JohnEhlen</dc:creator>
      <dc:date>2023-01-13T22:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python 3 runtime ArcGIS Server Linux Crontab</title>
      <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/1271277#M67204</link>
      <description>&lt;P&gt;Did you ever figure out what was happening? Running into this same issue at 10.9.1 as well. Running script manually works fine but thought crontab receiving the same errors listed by&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/128590"&gt;@SiCasley&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 09:34:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/1271277#M67204</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2023-03-24T09:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python 3 runtime ArcGIS Server Linux Crontab</title>
      <link>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/1272607#M67268</link>
      <description>&lt;P&gt;With respect to this specific issue, I found that is occurs whenever you pipe output of a Python script with an arcpy command.&amp;nbsp; The script will execute fine until it reaches the arcpy command (import arcpy will work though).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So&amp;nbsp;&lt;STRONG&gt;python myarcpyscript.py&lt;/STRONG&gt; will execute fine, but&amp;nbsp;&lt;STRONG&gt;python myarcpyscript.py &amp;gt;&amp;gt; myarcpylog.log&lt;/STRONG&gt; will terminate ungracefully with&amp;nbsp;&lt;STRONG&gt;Fatal Python error: Py_Initialize: can't initialize sys standard streams&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;OSError: [WinError 6] Invalid handle.&amp;nbsp;&lt;/STRONG&gt;Esri support confirmed this is an issue at 10.9.1 (and maybe earlier), but was fixed at 11.0.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 17:38:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-3-runtime-arcgis-server-linux-crontab/m-p/1272607#M67268</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2023-03-28T17:38:42Z</dc:date>
    </item>
  </channel>
</rss>

