davebye

MakeTableView_management frustrations

Discussion created by davebye on Oct 31, 2012
Latest reply on Nov 5, 2012 by davebye
Hi,

ArcGIS 10.0, WinXP

I have a similar issue to that posted in

http://forums.arcgis.com/threads/59172-MakeTableView_management-causes-an-exception-when-outside-of-ArcMap

however, though I can get the table added successfully using the following lines in the python immediate window

>>> x = 'P:\\Work\\CMA_LMD\\Users\\dbye\\Data\\2012\\scratch.gdb'
>>> arcpy.env.workspace = x
>>> arcpy.env.workspace
u'P:\\Work\\CMA_LMD\\Users\\dbye\\Data\\2012\\scratch.gdb'
>>> arcpy.MakeTableView_management('bf_201211011009_workspaces', 'test')
<Result 'test'>

the following lines in a script:

arcpy.AddMessage("AddResults ")
x = u'P:\\Work\\CMA_LMD\\Users\\dbye\\Data\\2012\\scratch.gdb'
arcpy.env.workspace = x
arcpy.AddMessage(arcpy.env.workspace)
arcpy.MakeTableView_management('bf_201211011009_workspaces', 'test')

don't work! There is no exception thrown, the script outputs to the gp results window:

...
AddResults
P:\Work\CMA_LMD\Users\dbye\Data\2012\scratch.gdb
Completed script ScanWorkspace2GDB...
Succeeded at Thu Nov 01 15:06:08 2012 (Elapsed Time: 19.00 seconds)

But no table is added to the map document...

I hope I have stared at this way to long and overlooking something simple. What looks like identical code executes perfectly in the python window, but won't work in a script. Note also that I have also set the scratchWorkspace equivalent both in code and environment just in case that's a factor but to no avail.

Any ideas much appreciated. Cheers

Outcomes