Skip to main content

I am wrapping a standalone python script in a python creator and seem to be running into an issue. The script runs fine when I run it in IDLE. However, I am experiencing an error in my workbench when running the creator.

 

Error - error - `fme' instance does not have a method `input(self, feature)'. fme.input(self, feature) must be defined.

 

Script -

# Import system modules

import sys

import string

import os

import arcgisscripting

import logging

import logging.config

 

class fme:

  def main():

    logging.basicConfig(

     filename=r'\\\\maphub-amer-vfs.azure.chevron.com\\MapHub-NA\\ETL\\FME\\SJV\\TEST\\Projects\\iDOT\\Common\\Scripts\\NetInj_NatNbr_Clip.log', filemode = 'w',

     format='%(asctime)-6s: %(name)s - %(levelname)s - %(message)s')

    logger = logging.getLogger('NetInjectionClip_log')

    logger.setLevel(logging.INFO)

 

 

    try:

  # Create the Geoprocessor object

      gp = arcgisscripting.create()

      gp.overwriteoutput = True

 

      logger.info("checking out extension")

 

  # Check out any necessary licenses

      gp.CheckOutExtension("spatial")

 

      logger.info("checking out successful")

 

  # Load required toolboxes...

  #gp.AddToolbox("E:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")

  #gp.AddToolbox("E:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

 

 

  # Local variables...

   

      NatNbr_conv_7test = r"\\\\maphub-amer-vfs.azure.chevron.com\\MapHub-NA\\ETL\\FME\\SJV\\TEST\\Projects\\iDOT\\Grids\\SJVBU_SDESJV_TEST.sde\\SJVBU.NATNBR_CONV_7"

      NatNbr_conv_14test = r"\\\\maphub-amer-vfs.azure.chevron.com\\MapHub-NA\\ETL\\FME\\SJV\\TEST\\Projects\\iDOT\\Grids\\SJVBU_SDESJV_TEST.sde\\NATNBR_CONV_14"

      NatNbr_conv_7test_clip = r"\\\\maphub-amer-vfs.azure.chevron.com\\MapHub-NA\\ETL\\FME\\SJV\\TEST\\Projects\\iDOT\\Grids\\SJVBU_SDESJV_TEST.sde\\NATNBR_CONV_7_CLIP"

      NatNbr_conv_14test_clip = r"\\\\maphub-amer-vfs.azure.chevron.com\\MapHub-NA\\ETL\\FME\\SJV\\TEST\\Projects\\iDOT\\Grids\\SJVBU_SDESJV_TEST.sde\\NATNBR_CONV_14_CLIP"

      tbl_cy_geog_netinj_clip = r"\\\\maphub-amer-vfs.azure.chevron.com\\MapHub-NA\\ETL\\FME\\SJV\\TEST\\Projects\\iDOT\\Grids\\SJVBU_SDESJV_TEST.sde\\TBL_CY_GEOG_NETINJ_CLIP"

      tbl_cy_geog_netinj_clip__2_ = r"\\\\maphub-amer-vfs.azure.chevron.com\\MapHub-NA\\ETL\\FME\\SJV\\TEST\\Projects\\iDOT\\Grids\\SJVBU_SDESJV_TEST.sde\\TBL_CY_GEOG_NETINJ_CLIP"

   

      cy_gisdata_GISPUB_tbl_cy_fac_wls_netinjection = r"\\\\maphub-amer-vfs.azure.chevron.com\\MapHub-NA\\ETL\\FME\\SJV\\TEST\\Projects\\iDOT\\Grids\\SJVBU_SDESJV_TEST.sde\\SJVBU.TBL_CY_FAC_WLS_NETINJECTION"

      logger.info(cy_gisdata_GISPUB_tbl_cy_fac_wls_netinjection)

  #print cy_gisdata_GISPUB_tbl_cy_fac_wls_netinjection

 

      logger.info("begin Natual Neighbor process")

 

  # Process: Natural Neighbor...

      gp.NaturalNeighbor_sa(cy_gisdata_GISPUB_tbl_cy_fac_wls_netinjection, "SevenDayAvg", NatNbr_conv_7test, "120")

 

      logger.info("Natual Neighbor process successful, begin clip")

 

  # Process: Clip...

      gp.Clip_management(NatNbr_conv_7test, "1499116.31909478 673045.729143351 1507415.60400535 680852.946468517", NatNbr_conv_7test_clip, tbl_cy_geog_netinj_clip, "", "ClippingGeometry")

 

      logger.info("clip successful, begin Natural Neighbor process2")

 

  # Process: Natural Neighbor (2)...

      gp.NaturalNeighbor_sa(cy_gisdata_GISPUB_tbl_cy_fac_wls_netinjection, "FourteenDayAvg", NatNbr_conv_14test, "120")

 

      logger.info("Natual Neighbor process2 successful, begin clip2")

 

  # Process: Clip (2)...

      gp.Clip_management(NatNbr_conv_14test, "1499116.31909478 673045.729143351 1507415.60400535 680852.946468517", NatNbr_conv_14test_clip, tbl_cy_geog_netinj_clip__2_, "", "ClippingGeometry")

 

      logger.info("clip2 successful")

  #print("success")

 

   

    except:

      logger.exception("job failed")

      print("failed")

   

    finally:

 

   

# Check in any necessary licenses

      gp.CheckInExtension("spatial")

 

fme.main()   

 

 

 

Thanks in advance!

 

 

Hi @cseago​ , you have to define a class according to the "Template Class Interface" which is predefined in PythonCreator (see the screenshot). Once the translation has started, FME generates an instance of the class specified in the "Class to Process Features" parameter and calls its "input" method. You therefore should implement the "input" method so that your own script will be executed.

pythoncreator-template-class-interface


Reply