title: ast.py error when Caching Web tiles from a service
body: <p>I am working on creating cached tiles from our server, for people to load into mobile apps and use offline.</p>
  <p>I keep running into ast.py errors on line 44, which is the finishtime = time.clock().  But even when i remove the line for creating reports, i continue to get other ast.py errors.</p>
  <pre><code>SyntaxError  Traceback (most recent call last)
  file: C:\Program Files\ArcGis\Pro\bin\Python\envs\arcgispro-py3\lib\ast.py, in parse:
  line 35: return compile(source, filename, mode, PyCF_ONLY_AST)
  
  SyntaxError: invalide sytax (&lt;string&gt;, line 44)
  </code></pre>
  <p>The string of code that i am trying to run is</p>
  <pre><code>import arcpy
  from arcpy import env
  import os, sys, time, datetime, traceback, string
  
  # Set environment settings
  env.workspace = &quot;E:\2_Data\MapTileCache&quot;
  
  # List of input variables for map service properties
  connectionFile = r&quot;C:\Users\&lt;ommitted&gt;\AppData\Roaming\ESRI\Desktop10.6\ArcCatalog&quot;
  server          = &quot;ommitted&quot;
  serviceName         = &quot;World_Street_Map_2D.MapServer&quot;
  inputService        = connectionFile + &quot;\\&quot; + server + &quot;\\&quot; + serviceName
  targetCachePath     = &quot;E:\2_Data\MapTileCache\Tiles&quot;
  exportCacheType     = &quot;TILE_PACKAGE&quot;
  copyDataFromServer  = &quot;DO_NOT_COPY&quot;
  storageFormat       = &quot;COMPACT&quot;
  scales          = [500000,250000,125000,64000]
  numOfCachingServiceInstances = &quot;2&quot;
  areaOfInterest      = &quot;E:\2_Data\MapTileCache\ATAK_ext.shp&quot;
  exportExtents       = &quot;&quot;
  overwriteTiles      = &quot;MERGE&quot;
  
  currentTime = datetime.datetime.now()
  arg1 = currentTime.strftime(&quot;%H-%M&quot;)
  arg2 = currentTime.strftime(&quot;%Y-%m-%d %H:%M&quot;)
  
  report = open(file, 'w')
  
  try:
      starttime = time.clock()
      result = arcpy.server.ExportMapServerCache(inputService, targetCachePath, exportCacheType, copyDataFromServer, storageFormat, scales, numOfCachingServiceInstances, areaOfInterest, exportExtents, overwriteTiles)
  
  finishtime = time.clock()
  elapsedtime = finistime - startime
  
  while result.status &lt; 4:
          time.sleep(0.2)
  resultValue = result.getMessages()
  report.write (&quot;completed &quot; + str(resultValue))
  
  print (&quot;Exported cache successfully for mapservice &quot; + serviceName + &quot; To &quot; + \targetcachepath + &quot; in &quot; + str(elapsedtime) + &quot; sec \n on &quot; + arg2)
  
  except Exception as e:
      # If an error occurred, print line number and error message
      tb = sys.exc_info()[2]
      report.write(&quot;Failed at \n&quot; &quot;Line %i&quot; % tb.tb_lineno)
      report.write(str(e))
  
  print(&quot;Exported Map server Cache  using area of Interest&quot;)
  
  report.close()
  </code></pre>
  <p>I am not sure what this ast.py file is doing, is it broke or is it properly identifying an issue in my code and i just dont know how to fix it?</p>
  <p>Thanks for any help.</p>