0

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?

1
  • 2
    Could you specify your problem a little bit more, e.g. by providing the script you are using to import toolbox and model?
    – Martin
    Commented Dec 10, 2013 at 6:24

1 Answer 1

2

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.

1
  • 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
    Commented Dec 11, 2013 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.