POST
|
Perhaps someone can help me. I tried to reconcile and psot my database to a version and received the following error: The Version could not be reconciled. Another application is editing the version. This is my personal version and it still occurs after all arcmap applications are closed and restarted as well as my computer restarted.
... View more
07-25-2012
08:28 AM
|
0
|
0
|
227
|
POST
|
See attached python script. My script already uses this function.. I was just trying to figure out a way to change the connection properties to a direct connect in python.
... View more
02-07-2012
09:33 AM
|
0
|
0
|
299
|
POST
|
Hi all, I have created a tool with the help of some of my fellow GIS users on this forum, that repairs broken data sources in an mxd based on the location of the mxd, old path connection and new path connection. With the release of 10.1, all of our databases are moving to direct connect. Previously, we were not connecting using a direct connect. My question to you all is there a way to change the connection settings from the old connection to the direct connect using python? I have included a document containing two screenshots, one showing the way we connect now and one showing how we are going to connect in the near future.. Brittney
... View more
02-07-2012
05:22 AM
|
0
|
3
|
471
|
POST
|
I attempted to run both scripts and they both failed. The first script said folderPath is not defined and the second secript said that there was an invalid mxdname. Any ideas? For the creation of the tool, are their any output variables that should be created?
... View more
02-06-2012
05:51 AM
|
0
|
0
|
205
|
POST
|
PYTHONPATH is a Windows (or UNIX) environment variable that needs to be set before the script is run, if you need it. The purpose of that variable is to modify sys.path when Python launches. Sys.path is a list of folders that tells Python where to look for imports, ie "import mymodule" will look for a file "mymodule.py" or "mymodule.pyc" through the sys.path, and use the first one it finds. It looks like you are trying to invoke the ntpath module. This module is already in the sys.path, so you could get to it with: import ntpath However, you don't need to import it -- the os module is what you want (and what you are using). I'm pretty sure os calls ntpath for you on windows, something else on Mac or Unix. If you need to alter where to look at runtime, you can alter the sys.path as follows. import sys
sys.path.append(r"C:\mytools\python\modules") You can check out where imports will look by listing your sys.path:
>>> import sys
>>> sys.path Note, by default, "" is the first item in sys.path. So if you include a custom module in the same folder as the script, it will always use that version. http://docs.python.org/tutorial/modules.html I attempted to run both scripts and they both failed. The first script said folderPath is not defined and the second secript said that there was an invalid mxdname. Any ideas? For the creation of the tool, are their any output variables that should be created?
... View more
02-06-2012
05:50 AM
|
0
|
0
|
205
|
POST
|
I have reposted my code. Does anyone have any ideas on why it is not wiriting over my mxd's? It works as a standalone script, but not as a tool in a toolbox. Thanks, Brittney
... View more
02-03-2012
12:09 PM
|
0
|
0
|
504
|
POST
|
import arcpy, os
PYTHONPATH = "C:\Python26\ArcGIS10.0\lib\ntpath.pyc"
folderpath = arcpy.GetParameterAsText(0)
oldpath = arcpy.GetParameterAsText(1)
newpath = arcpy.GetParameterAsText(2)
print 'running'
i=0
#create a folder within a local folder to store the mxds
folderPath = r""
for filename in os.listdir(folderPath):
fullpath = os.path.join(folderPath, filename)
if os.path.isfile(fullpath):
basename, extension = os.path.splitext(fullpath)
if extension.lower() == ".mxd":
mxd = arcpy.mapping.MapDocument(fullpath)
oldpath = ""
newpath = r""
#mxd.replaceWorkspaces(oldpath, "SDE_WORKSPACE", newpath, "SDE_WORKSPACE",True)
print "ok"
mxd.findAndReplaceWorkspacePaths(oldpath, newpath)
#mxd.save()
mxd.save()
print '...', basename, extension, "finished"
... View more
02-02-2012
04:22 AM
|
0
|
0
|
504
|
POST
|
What is the particular error you are getting? Or does it run through without error and just not make any changes to the mxd? Also, posting your code with code blocks will make it easier for us to help. I am not getting an error, rathre it is nto saving my mxds
... View more
02-02-2012
04:06 AM
|
0
|
0
|
504
|
POST
|
[/HR] I would try this mxd.saveACopy(file_name, {version}) I had this originally in my code, but I simply just want to update the existing mxd's. (Since I will be running the tool multiple times to repair multiple sde databases within a single mxd.) Do I need to create a derived variable? If so, where/how would I call this out in my code? Any help would be greatly appreciated.
... View more
01-31-2012
12:22 PM
|
0
|
0
|
504
|
POST
|
Ok I got the tool to work but it is not saving the mxds.. am I missing a variable? Thanks, Brittney
... View more
01-31-2012
09:43 AM
|
0
|
0
|
504
|
POST
|
Hi all, I am trying to create a tool from a script that repairs all broken data sources in an mxd. I have posted the code as follows: import arcpy, os PYTHONPATH = "C:\Python26\ArcGIS10.0\lib\ntpath.pyc" folderpath = arcpy.GetParameterAsText(0) oldpath = arcpy.GetParameterAsText(1) newpath = arcpy.GetParameterAsText(2) print 'running' i=0 #create a folder within a local folder to store the mxds folderPath = r"" for filename in os.listdir(folderPath): fullpath = os.path.join(folderPath, filename) if os.path.isfile(fullpath): basename, extension = os.path.splitext(fullpath) if extension.lower() == ".mxd": mxd = arcpy.mapping.MapDocument(fullpath) oldpath = "" newpath = r"" #mxd.replaceWorkspaces(oldpath, "SDE_WORKSPACE", newpath, "SDE_WORKSPACE",True) print "ok" mxd.findAndReplaceWorkspacePaths(oldpath, newpath) #mxd.save() mxd.save() print '...', basename, extension, "finished" However, when I run the tool it does not work. Any ideas as to what I have to set my input parameters as or if there is something wrong in my code? Thanks! Brittney
... View more
01-31-2012
08:04 AM
|
0
|
13
|
2625
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|