|
POST
|
Mathew: I freeze on different mxds depending upon the subdirectory that I choose to convert the SDE datasources for, so it is not the same file every time. Eventually I will need to convert up to 3 thousand mxds with each mxd having from 1 SDE connection to 40 or 50 SDE connections. This process will need to be done when my organization migrates from Oracle Client 10g to Oracle Client 11x, as this information is embedded in the direct connection string for every SDE connection. This is why this information is important to me.
... View more
03-22-2012
06:59 AM
|
0
|
0
|
1580
|
|
POST
|
Ganesh: Here are some changes you can make to this script: Instead of import arcgisscripting import os, sys gp = arcgisscripting.create(9.3) gp.OverWriteOutput = 1 Use import os, sys import arcpy import arcpy.mapping from arcpy import env arcpy.env.overwriteOutput = True Instead of featureClassA = gp.GetParameterAsText(0) Use featureClassA = arcpy.GetParameterAsText(0) Instead of dscB = gp.Describe(featureClassB) Use dscB = arcpy.Describe(featureClassB) I hope this gets you started to see where you need to make changes in the rest of the code for v10.
... View more
03-22-2012
06:52 AM
|
0
|
0
|
1166
|
|
POST
|
Mathew: Can you share your code of batching through 500 mxds? The reason I ask is because maybe this is the cause of the memory issue I am having with replacing SDE connections. This phenonmenon happens everytime where I get through a certain amount of mxds before python freezes up. This same problem did not occur if I batch converted sources to file geodatabases or personal geodatabases.
... View more
03-22-2012
06:29 AM
|
0
|
0
|
1580
|
|
POST
|
To All Python Users: In ArcGIS v9.3.1 I want to be able to set certain variables such as the gp.workspace from a configuration file outside the python script so it is not hard-coded in the script. I was able to read in text for other variables I needed to set but it did not work with gp.workspace as I received the following error: Traceback (most recent call last): File "G:\deptdata\GIS\GIS_Services\User\server_Scripts\01_Data_Read_Config.py", line 37, in <module> gp.workspace = "'" + source + "'" RuntimeError: NotInitialized The code to set the variable source is as follows: vars = myfile.read().rstrip().split(",") connSDE = vars[0] EOC_source = vars[1] gp.workspace = "'" + EOC_source + "'" (I have tried gp.workspace = """ + EOC_source + """ as well as gp.workspace = EOC_source Can gp.workspace be set with a variable? If so, what am I doing wrong with the syntax? Any help or hints regarding this issue are greatly appreciated. Thanks.
... View more
03-22-2012
06:18 AM
|
0
|
3
|
841
|
|
POST
|
jacobne: What do you mean by synchronize? Do you mean putting the data together in the same projection?
... View more
03-21-2012
06:33 PM
|
0
|
0
|
1985
|
|
POST
|
renatognog: Is your data being consumed by an ArcGIS Server service or ArcIMS service? If it is I would recommend a truncate and append process that bypasses schema locks that are in place from the above mentioned services. DeleteRows_Management followed by Append_Management
... View more
03-21-2012
06:30 PM
|
0
|
0
|
502
|
|
POST
|
Mathew: I do not have an answer for your question, but I am interested in the performance of your script. I have written a replacedatasource script for SDE layers that loops through a directory searching for mxds and then resourcing the SDE layers. Unfortunately, the script eventually uses all the computer's RAM and it just hangs so I have to kill it in Task Manager. Would you know if the memory on your python script keeps increasing? Your script might not have frozen because you did not process enough mxd files in your batch. Any insight on your script and system would be greatly appreciated. Thanks.
... View more
03-21-2012
06:27 PM
|
0
|
0
|
1580
|
|
POST
|
Greg: Have you tried looking at python to accomplish this task? It would probably result in a lot less code on your part. In v10.1 you will be able to associate python code with buttons on a toolbar which should make this even easier.
... View more
03-08-2012
10:26 AM
|
0
|
0
|
1749
|
|
POST
|
Does anyone from ESRI have any ideas on how I would accomplish this goal in a bat file? Or is there another method of calling the python files that can be used? I currently use the bat file to sequentially call python scripts so they proceed in a specific order making sure the previous task has been completed. As I said in the original Post, I need to add the full path to the python script and log files in the bat file on a Windows 2008 Server which I did not need to do in Windows 2003 Server. Also I would like to use the txt file for the paths so it acts as a config file to be used by multiple scripts so 1 file can be changed for multiple scripts instead of needing to change multiple files.
... View more
03-07-2012
03:46 AM
|
0
|
0
|
1625
|
|
POST
|
Curtis: I think my original post might be a bit misleading. The variables I am trying to pass into the bat file are the location of the the python script and the location of the log file generated from the bat file. When I ran bat files as Scheduled Tasks in Windows Server 2003, I only needed to provide the name of the python script and log file because it understood it was a path relative to the location of the bat file. Now on Windows Server 2008, the bat file never calls the python script or log file unless I supply the entire path to these files. I want to store these paths in a text file to simplify the update of my system and the scripts that are used. I have 2 reasons for this. I can have multiple scripts that need the same python scripts, so I can use the text file to supply this information to all bat files. In addition, if the location changes or this bat file is used on a different server, I only need to make the change in the text file and not each bat file. I hope this clears up why I want to be able to read in information from a txt file in a bat file.
... View more
03-03-2012
09:11 AM
|
0
|
0
|
1625
|
|
POST
|
To All Python Users That Use Bat Files to Call Python Scripts: I am trying to read in values from a txt file in a bat file that will be used as variables when calling python scripts within the bat file. I have searched the Internet for the proper syntax to accomplish this goal, but I am unable to read from a txt file in the bat file. Does anyone have experience with this task and could provide some sample code so I can see where I am going wrong? Any help or hints are greatly appreciated. Thanks.
... View more
03-02-2012
08:14 AM
|
0
|
5
|
2781
|
|
POST
|
Jeremy: Here is a bat file example that calls a python script: @echo off
set pyexePath="C:\Python26\ArcGIS10.0\python.exe"
set pylogPath="C:\GIS\ServerProcesses\Bezier_Removal\Bezier_Remover_Simplify.log"
set BezRemove_pyPath="C:\GIS\ServerProcesses\Bezier_Removal\01_Bezier_Remover.py"
echo Start time: %time% > %pylogPath%
REM Run the python script
echo ------ Update time: %time%
echo ------ Removing Bezier curves from RDCL in Transportation GDB --------
echo ------ Removing Bezier curves from RDCL in Transportation GDB -------- >> %pylogPath%
%pyexePath% %BezRemove_pyPath% >> %pylogPath%
echo End time: %time% >> %pylogPath% Here is the python script that this bat file is calling: # ---------------------------------------------------------------------------
# Bezier_Remover.py
# Created on: 2011-11-15 15:27:13.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import sys, string, os
import arcpy
import arcpy.mapping
from arcpy import env
import smtplib #E-mail library
# Set environment
arcpy.env.overwriteOutput = True
# Local variables:
RDCL_SRCH__2_ = "RDCL_SRCH"
TRANS_RDCL_SRCH = r"\\Server\GIS\Enterprise\Data\transportation\Transportation.gdb\TRANSPORTATION_RDCL_SRCH"
try:
print("Densifying TRANSPORTATION_RDCL to remove Bezier Curves")
# Process: Densify
arcpy.Densify_edit(TRANS_RDCL_SRCH, "DISTANCE", "25 Feet")
except:
print arcpy.GetMessages(2)
SUBJECT = "Road Densify Script Failed"
TO = "person@mail.org"
FROM = "Process_Server"
text = "Removal of Bezier Curves in Roads failed"
BODY = string.join((
"From: %s" % FROM,
"To: %s" % TO,
"Subject: %s" % SUBJECT ,
"",
text
), "\r\n")
server = smtplib.SMTP('mail server address',mail server port #) #server = smtplib.SMTP(HOST)
server.sendmail(FROM, [TO], BODY)
server.quit() This is a very simple script that I have had running successfully on my Windows Server 2008 server for about 2 months now. The script simply removes Bezier curves from a polyline feature class as the web application that uses this data, fails when working with Bezier curves. I hope this helps you to solve your problem
... View more
03-01-2012
07:35 AM
|
0
|
0
|
2345
|
|
POST
|
Jeremy: I am also in the process of migrating python scripts from a Windows Server 2003 server to a Windows Server 2008 server. I thought it was going to be a straight forward process, but it has been more difficult than I had expected. Do you call your python scripts from a bat file? That is how I call my python scripts. I did not need to modify the python scripts in the Windows Server 2008 server environment, but I did need to modify my bat files that called the python scripts. Some of the differences in the bat file syntax included: 1.) Need to call the python scripts using their full path - I was able to call the script in Windows Server 2003 because it recognized the relative path 2.) Need to call other dependent files (script log files) using their full path - I was able to call the script in Windows Server 2003 because it recognized the relative path 3.) In order to make the bat file code more readable, I set variables for the path to the python script and log files and used these variables to reference the files throughout the bat file (again due to the fact that relative paths to dependent files of the bat file are not recognized) Unlike yourself, my code to generate an E-mail if errors were encountered worked without modification when I moved from Windows Server 2003 server to a Windows Server 2008 server
... View more
03-01-2012
06:25 AM
|
0
|
0
|
2345
|
|
POST
|
Miroslav: I have also created a script that performs this task but I do not need to specify credentials as you say when I open the new mxd. Are you using the ReplaceDataSource method to make this server switch? Also, I have the script loop through all subfolders in a user selected folder where it targets mxd files and changes the SDE connection from one SDE server to another. The problem I have is that the memory keeps building up until the script locks up. Do you perform this script on one mxd at a time or is it a batch process? If its a batch process and you do not have a memory buildup, I would be interested in taking a look at your python code. Thanks.
... View more
02-29-2012
08:15 AM
|
0
|
0
|
380
|
|
POST
|
Felix: As a workaround you might want to write a script that just saves the file through python before running the BrokenLinks script. Maybe the Save operation flushes out old SDE connections, but the SaveACopy operation does not. Are the mxds that you are processing currently saved as v9.3 or earlier? Or have these mxds been created or saved previously in v10? I had some issues where I tried to run python scripts on v9.3 mxds where they crashed python in v10 and I was unable to open the mxd in v10. If I save the file in v9.3 or I saved the mxd back to v9.3 in python, the mxd would then open in v10. It seems that this Save operation in v9.3 was flushing out bad or corrupt objects for v10.
... View more
02-29-2012
05:03 AM
|
0
|
0
|
1635
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 1 | 09-26-2025 06:10 AM | |
| 1 | 09-04-2025 02:19 PM | |
| 1 | 08-29-2025 08:29 AM | |
| 1 | 08-21-2025 12:45 PM |
| Online Status |
Offline
|
| Date Last Visited |
Wednesday
|