AnsweredAssumed Answered


Question asked by deleted-user-Pi5x1UjkS2PY on Nov 25, 2014
Latest reply on Nov 29, 2014 by curtvprice

I am storing my dypes in a string but it does not seem to like it.  Anyway that I can do something like this.  I'm sure their is a simple fix.  Code works if I hard code instead of the string but I am trying to make this a function so that I can reuse this code.




    datarray = []
    #for row in cursor:
    for row in cursor.fetchall():
    dtype = np.dtype(get_dtype)




    #dtype = np.dtype([('YEAR', '<f8'), ('REGIONID', '<f8'), ('DISTRICTID', '<f8'), ('REGIONNAME', '|S255'), ('DISTRICTNAME', '|S255'), ('DIVLOC', '|S255'), ('STORENAME', '|S255'), ('CLUSTER', '|S255'), ('SUBID', '|S255'), ('SUBNAME', '|S255'), ('SEQUENCE', '<f8'), ('S_AREA', '<f8'), ('FS_AREA', '<f8'), ('ST_AREA', '<f8'), ('FR_AREA', '<f8'), ('SO_AREA', '<f8'), ('SL_AREA', '<f8'), ('TOTALSALES', '<f8'), ('OWNEDSALES', '<f8'), ('LEASEDSALES', '<f8'), ('GM', '<f8'), ('PROD', '<f8'), ('GMPROD', '<f8'), ('LATITUDE', '<f8'), ('LONGITUDE', '<f8'), ('RANKSALESSUB', '<f8'), ('RANKPRODSUB', '<f8'), ('RANKSALESSUBD', '<f8'), ('RANKPRODSUBD', '<f8'), ('RANKSALESSUBR', '<f8'), ('RANKPRODSUBR', '<f8'), ('RANKSALESSUBS', '<f8'), ('RANKPRODSUBS', '<f8'), ('RANKSALESSUBC', '<f8'), ('RANKPRODSUBC', '<f8')])



Getting this error:


  File "T:/Current/GISWeb/Python Script/", line 400, in defAddSQLTable_CreateShapefile

    dtype = np.dtype(get_dtype)

  File "C:\Python27\ArcGIS10.2\lib\site-packages\numpy\core\", line 234, in _commastring

    newitem = (dtype, eval(repeats))

  File "<string>", line 1



SyntaxError: unexpected EOF while parsing