Hello, I've been developing a script that processes vector and raster data based on a REST API requests.
The script was prepared in Pycharm and worked fine on a test virtual machine (1). I created a virtual environment clone so that it could be used on the target machine (2).
However, when the same app is run on a different machine (2), the script returns AttributeError: ERROR 87934 when trying to set a workspace in a hardcoded path - the very beggining of the whole code:
File "C:\=====\Documents\gisapp\main.py", line 55, in set_workspace
arcpy.env.workspace = absolute_path
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 543, in set_
self[env] = val
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 607, in __setitem__
ret_ = setattr(self._gp, item, value)
AttributeError: ERROR 87934
Here is the function that return the error. It should handle the workspace definition with all the additional code for troubleshooting:
def set_workspace(location):
absolute_path = os.path.abspath(location)
print('Attempting to set workspace:', absolute_path)
if isdir(absolute_path):
print('Setting workspace:', absolute_path)
arcpy.env.workspace = absolute_path
set_workspace.workspace = arcpy.env.workspace
arcpy.env.overwriteOutput = True
else:
print('Invalid workspace:', absolute_path)
set_workspace(r'C:\test')
The weird part is that the very same functionality is easily achieved when trying to set the workspace on the same machine (2) and generate a gdb in the same location but outside of flask, i.e. using this code:
import arcpy
absolute_path = r'C:\test'
arcpy.env.workspace = absolute_path
arcpy.management.CreateFileGDB(absolute_path, 'baza')
print('success!')
What is even more interesting, I tried to reproduce the error on the machine I use for everyday work (3) that is different from the one the script was first prepared (1) and the machine used in production (2), and it works perfectly fine. ArcGIS Pro 3.1 is installed on each of these machines.
Do you guys have any idea what might cause this issue?
Thanks in advance,
Jakub