Select to view content in your preferred language

Takes no arguments error.

3651
2
09-27-2011 11:05 AM
TylerCopple
New Contributor
I was attempting to run Setup_Customers_Using_Tabular_Data , I modified the paths to fit my environment but when I run the program I receive

SetupCustomersByTable() takes no arguments (6 given)

*note* I had to modify the exception clause to output this

A little investigation in IDLE showed this:

IDLE 2.6.5      
>>> import arcview
>>> import arcpy
>>> print hasattr(arcpy.ba, 'SetupCustomersByTable')

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    print hasattr(arcpy.ba, 'SetupCustomersByTable')
AttributeError: 'module' object has no attribute 'ba'
>>> print hasattr(arcpy, 'ba')
False
>>> arcpy.ImportToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Business Analyst Tools.tbx")

<module 'ba' (built-in)>
>>> print hasattr(arcpy, 'ba')
True
>>> print hasattr(arcpy.ba, 'SetupCustomersByTable')
True
>>> import inspect
>>> print(inspect.getargspec(arcpy.ba.SetupCustomersByTable))
ArgSpec(args=[], varargs=None, keywords=None, defaults=None)


This is not the only function this happens with, but all of them in the BA package. I've never gotten any full arcpy tutorial to work from the website, am I missing something obvious setup wise?

Tyler
0 Kudos
2 Replies
Jason_RobinsonRobinson
Esri Regular Contributor
I was attempting to run   Setup_Customers_Using_Tabular_Data , I modified the paths to fit my environment but when I run the program I receive  

SetupCustomersByTable() takes no arguments (6 given)

*note* I had to modify the exception clause to output this

A little investigation in IDLE showed this: 

IDLE 2.6.5      
>>> import arcview
>>> import arcpy
>>> print hasattr(arcpy.ba, 'SetupCustomersByTable')

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    print hasattr(arcpy.ba, 'SetupCustomersByTable')
AttributeError: 'module' object has no attribute 'ba'
>>> print hasattr(arcpy, 'ba')
False
>>> arcpy.ImportToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Business Analyst Tools.tbx")

<module 'ba' (built-in)>
>>> print hasattr(arcpy, 'ba')
True
>>> print hasattr(arcpy.ba, 'SetupCustomersByTable')
True
>>> import inspect
>>> print(inspect.getargspec(arcpy.ba.SetupCustomersByTable))
ArgSpec(args=[], varargs=None, keywords=None, defaults=None)


This is not the only function this happens with, but all of them in the BA package. I've never gotten any full arcpy tutorial to work from the website, am I missing something obvious setup wise? 

Tyler


Tyler,

If you could attach your script we can certainly take a look at it and see if we can diagnose the issue.

Jason
0 Kudos
TylerCopple
New Contributor
I've managed to solve the problem simple by opening ArcMap.  I hadn't tried to use the software since a re-install and opening ArcMap must have initialized some global state because the method signatures were found the next time I called them.

However, I have moved onto another issue.

First: http://help.arcgis.com/de/arcgisdesktop/10.0/help/index.html#//00mm0000001p000000.htm The parameter list in the example and the syntax list do NOT match, which is extremely misleading. 

Second: Neither of those seem to be exactly as it's listed in Arcpy using reflection

IDLE 2.6.5      
>>> import arcview;
>>> import arcpy
>>> arcpy.ImportToolbox("d:\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Business Analyst Tools.tbx")
<module 'ba' (built-in)>
>>> import inspect
>>> print(inspect.getargspec(arcpy.ba.LocatorReport))
ArgSpec(args=['InputFeatureLayer', 'IDField', 'NameFldName', 'BusinessLayer', 'FieldsToAppear', 'IsLandscape', 'All_Or_Single_Or_Selected', 'ByID_Or_ByName', 'Single_Site', 'WayToSelectBusiness', 'RadiusToSelectBusinesses', 'NumberOfBusinessesToSelect', 'DistanceCalculateMethod', 'AddDistanceToBusiness', 'WayToDefineDistanceField', 'DesireLinesDistanceField', 'NeedReportOutput', 'ReportTitle', 'ReportDir', 'NeedFeatureclassOutput', 'OutputFeatureClass', 'BarrierFeatureClasses', 'ReportFormats'], varargs=None, keywords=None, defaults=(None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None))
0 Kudos