I have created an ArcToolbox and a Model in the toolbox. It uses a lot of Spatial Analyst tools and deals with raster images.
When I imported the toolbox in a Python script and ran the model from Python in Windows command prompt, I got a few warning messages as below but the model got run successfully.
<string>:1: SyntaxWarning: import * only allowed at module level
It was shown several times. I am unable to tell where this error comes from.
Any idea?
-
2Could you specify your problem a little bit more, e.g. by providing the script you are using to import toolbox and model?Martin– Martin2013年12月10日 06:24:08 +00:00Commented Dec 10, 2013 at 6:24
1 Answer 1
Your warning message sounds similar to this ArcGIS Discussion Forum thread and the solution there seemed to be:
according to the help, the raster calculator is for use inside arcmap only, for calculations in python you should use mapalgebra: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000z7000000.htm
Perhaps you are trying to use the Raster Calculator rather than Map Algebra in the Python code you are calling from outside ArcMap.
-
Yeah. I used Raster Calculator in the Model but not Python script. Then I made a Python script, imported the toolbox and called the Model from there. So it is not directly calling Raster Calculator from Python script. From the command prompt window, I could see it ran successfully with a few SyntaxWarning messages.alextc– alextc2013年12月11日 02:40:39 +00:00Commented Dec 11, 2013 at 2:40
Explore related questions
See similar questions with these tags.