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?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Dec 10, 2013 at 5:48
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? 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.

answered Dec 10, 2013 at 7:45
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. Commented Dec 11, 2013 at 2:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.