Skip to main content
  • 1,261 Posts
  • 4,483 Replies
1261 Posts
Run workspace in ArcGIS Python toolbox (.pyt) ?

IsΒ itΒ possibleΒ toΒ runΒ anΒ FMEΒ WorkspaceΒ fromΒ withinΒ anΒ ArcGISΒ 10.xΒ PythonΒ ToolboxΒ (.pyt)?I'veΒ gotΒ ArcGISΒ DesktopΒ v10.6.1Β installed,Β withΒ 64-bitΒ BackgroundΒ GeoprocessingΒ installedΒ andΒ switchedΒ on.Β AndΒ I'veΒ gotΒ FMEΒ 2019.0.1Β (64-bit)Β installed.IΒ knowΒ howΒ toΒ runΒ aΒ workspaceΒ inΒ Python,Β asΒ explainedΒ here,Β andΒ thatΒ worksΒ allΒ fineΒ inΒ 64-bit.ButΒ whenΒ IΒ tryΒ toΒ embedΒ someΒ veryΒ simpleΒ FMEΒ PythonΒ codeΒ inΒ anΒ ArcGISΒ PythonΒ Toolbox,Β itΒ crashesΒ myΒ ArcGIS!Β IΒ guessΒ it'sΒ somethingΒ toΒ doΒ withΒ ArcGISΒ beingΒ 32-bitΒ byΒ defaultΒ thatΒ causesΒ it,Β soΒ maybeΒ itΒ cannotΒ beΒ done.Β ButΒ I'dΒ stillΒ likeΒ toΒ findΒ outΒ ifΒ anybodyΒ elseΒ hasΒ managedΒ toΒ crackΒ this.ThisΒ isΒ whatΒ IΒ do:InΒ ArcGIS,Β right-clickΒ inΒ aΒ folderΒ andΒ addΒ NewΒ >Β PythonΒ Toolbox.Β ThisΒ createsΒ aΒ Toolbox.pytΒ fileΒ withΒ aΒ toolΒ calledΒ 'Tool'Β inΒ it.Right-clickΒ theΒ Toolbox.pytΒ file,Β andΒ selectΒ Edit,Β whichΒ opensΒ theΒ fileΒ inΒ myΒ IDEAddΒ theΒ 3Β usualΒ linesΒ toΒ importΒ fmeobjectsΒ atΒ theΒ topΒ (seeΒ belowΒ inΒ bold)SetΒ "self.canRunInBackgroundΒ =Β True",Β whichΒ ensuresΒ theΒ toolΒ runsΒ inΒ the