Hello everybody,
Currently i'm developing an API that do some basic calculation (polygon area ... ) using arcpy. I'm using bottle.py with cherrypy as webserver.
At first i used the WSGIRef (default webserver of bottle.py, single-thread) and everything is fine but after switching to cherrypy (multi-threaed webserver), my code suddenly went down, look closely in to my source code it fail in these line:
arcpy.env.workspace = OutputLocation
Have someone ever facing this problem before?
I think the cellSize line needs to refer to a cellsize value and not the raster. So you need to get the raster properties first to get the Elevation_Raster cellsize
cs = arcpy.GetRasterProperties_management(Elevation_Raster, "CELLSIZEX")
arcpy.env.cellSize = cs.getOutput(0)
Even though i remove that line, it still produce the same error on: arcpy.env.workspace = OutputLocation . That error never happen when i use old webserver. Thank you very much
Make sure the output location format is correct - see Dan Patterson's blog /blogs/dan_patterson/2016/08/14/filenames-and-file-paths-in-python
I think it's correct Mr.Basson, because this code run fine with WSGIRef webserver, but can't work with cherrypy, i also print the output location and it still correct
So you've changed servers - is the output location still the same and a valid location?
Yes, it's still the same and valid Mr.Basson. In fact it raise the error at that step and the error is: AttributeError: ERROR 87934 ... As i know usually AttributeError is raised because there is no that attribute (env or workspace)
does ... import arcpy .... work? If it doesn't, the location of arcmap and hence arcpy is unknown... if it does, do as fcbassongis says
Yes, the import arcpy work Mr.Patterson
Good... now can you get a list of files in the folder/workspace? or examine the contents of a featureclass (ie ListFeatureClasses would be useful