I'm trying to build a dictionary from a table view in ArcMap using SearchCursor. Here is the snippet of code I'm having issues with:
valueDi = dict([(key, val) for (key, val) in arcpy.da.SearchCursor (joinFc, [joinIdFld, joinValFld])])
This is the error I'm geting:
Traceback (most recent call last): File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 323, in RunScript debugger.run(codeObject, __main__.__dict__, start_stepping=0) File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run _GetCurrentDebugger().run(cmd, globals,locals, start_stepping) File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 654, in run exec cmd in globals, locals File "N:\Common\Script\Drivers\PrepCleanScapesUpdate.py", line 1, in <module> import arcpy ValueError: too many values to unpack
I've checked the brackets and parentheses against a snippet of code used in an answer to Using UpdateCursor for joined field in ArcPy?