arcpy.mapping.MapDocument(“CURRENT”)

27774
21
05-21-2015 10:41 AM
LaszloCsunderlik
New Contributor II

Hi Guys!

I am writing a web application for my thesis in ArcPy and I would like to share my script code with the Flex but I can't share my script as geoprocesing service. The warning message: 00068 Script Script contains broken project data source: CURRENT Here is the script, where the "CURRENT" mapping module is. See attached!!

It would be very helpful if someone could find a solution for this. This script is working prefectly in desktop, I just can't publish because this error message.

Tags (1)
21 Replies
LaszloCsunderlik
New Contributor II

For your first question my answer is yes is that the window I then ran the script.

It doesn't crash in the Python window with the "CURRENT", but if i type the exact path it crashs with the same error message: IOError: MapDocObject: Unable to save.  Check to make sure you have write access to the specified file and that there is enough space on the storage device to hold your document.

With the "Current" everything worked perfectly, just couldn't share as geoprocessing service with the Flex

00068 Script contains broken project data source: CURRENT

0 Kudos
LukeWebb
Occasional Contributor III

The problem is because when you use "CURRENT", it does the process using the map that you have open already, so the file is not "locked".

When you hard code the path, it opens the file again (as well as keeping it open in the CURRENT arcmap session), then crashes as the current session has the file locked.

If you hard code the path, close the mxd, and publish it, it will work without error, as long as you dont have the map open when it try to save, as this locks the file.

Only one process can access the mxd at once, if you are inside ArcMAP that locks the file, if you use "CURRENT" it uses the locks you have open already, if you hardcode it, it trys to open a new lock.

I cant explain it better sorry, hopefully that is ok.