Select to view content in your preferred language

Python has no attributes

982
6
06-28-2010 05:11 PM
HolmSeifert
Emerging Contributor
Hi everyone,

i have a question.
have anyone an idea how i can solve this problem, occuring when runnig a pythin script.

type 'exceptions.AttributeError'>: 'module' object has no attribute 'arcv'
Failed to execute (Script).

thanks
0 Kudos
6 Replies
DanPatterson_Retired
MVP Emeritus
showing the script would help
perhaps it is supposed to be argv as in sys.argv
0 Kudos
HolmSeifert
Emerging Contributor
Hallo Dan Patterson,

yes, This was the solution. Instead of using sys.arcv I haves choosen "GetParameterAsText" and now it works very well.
Thank you very much for your help

Regards
Holm
0 Kudos
DanPatterson_Retired
MVP Emeritus
it is argv not arcv
in any event, sys.argv and GetParameterAsText are equivalent if you need string representations of the input, sys.argv allows for the passing of numbers
0 Kudos
DaleHoneycutt
Deactivated User
From my experience, GetParameterAsText() and GetParameter() are preferable to sys.argv[].  sys.argv[] has a character limit (I think it's 1024) while GetParameterAsText() doesn't have a limit.  I know that 1024 is a lot, but I have exceeded it on occasion for data buried in a deep folder hierarchy.  If you need the raw number (integer, double), use GetParameter(). 

(Prior to 9.0, I think, GetParameterAsText() wouldn't work when called from the OS prompt, so you had to use sys.argv[] unless you always ran as a script tool. This limitation was fixed at 9.0)
0 Kudos
SharynHickey1
Emerging Contributor
Hi

I think I have a similar problem. I am trying to run a script as a script tool in ArcCatalog, however when I do I get this error message:

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'GetParamaterAsText'
Failed to execute (SlopeRoad).

Though I have directed the inputs to be GetParamaterAsText in the script, I have copied some of the script to show what I have done. Is there something I have not added when changing it to as script tool with 'GetParamaterAsText' as the script works when I hard code the inputs??

import arcpy, os, string, sys
#overwrite existing data if there
arcpy.env.overwriteOutput = True
#check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
#
Service_Areas = arcpy.GetParamaterAsText(0)
DEM = arcpy.GetParamaterAsText(1)
Mask_NOW = arcpy.GetParamaterAsText(2)
OutDirectory = arcpy.GetParameterAsText(3)
#
arcpy.env.extent = Service_Areas
#cell size
arcpy.env.cellSize = DEM
#mask
arcpy.env.mask = Mask_NOW
GAslope = arcpy.sa.Slope(DEM, "PERCENT_RISE")
GAslope.save(OutDirectory + "\sloperaster.gdb\GAslope")

Thanks for any help! 🙂
0 Kudos
DanPatterson_Retired
MVP Emeritus
0 Kudos