Skip to main content
removed quotation marks from around True
Source Link
Erica
  • 9k
  • 4
  • 34
  • 80

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != "True"True:
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = "True"True
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

Or you might look at the TestSchemaLock function and try something along the lines of

import arcpy, time
lockTest = arcpy.TestSchemaLock(featureClass)

while lockTest != "True"True:
  time.sleep(10)
  lockTest = arcpy.TestSchemaLock(featureClass)

funcCopyData()

def funcCopyData():
  ...
  ...

I've never used the TestSchemaLock though, so I make no guarantees, but it sounds like it might meet what you are needing.

Hope it helps, edits/corrections welcome.

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != "True":
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = "True"
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

Or you might look at the TestSchemaLock function and try something along the lines of

import arcpy, time
lockTest = arcpy.TestSchemaLock(featureClass)

while lockTest != "True":
  time.sleep(10)
  lockTest = arcpy.TestSchemaLock(featureClass)

funcCopyData()

def funcCopyData():
  ...
  ...

I've never used the TestSchemaLock though, so I make no guarantees, but it sounds like it might meet what you are needing.

Hope it helps, edits/corrections welcome.

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != True:
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = True
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

Or you might look at the TestSchemaLock function and try something along the lines of

import arcpy, time
lockTest = arcpy.TestSchemaLock(featureClass)

while lockTest != True:
  time.sleep(10)
  lockTest = arcpy.TestSchemaLock(featureClass)

funcCopyData()

def funcCopyData():
  ...
  ...

I've never used the TestSchemaLock though, so I make no guarantees, but it sounds like it might meet what you are needing.

Hope it helps, edits/corrections welcome.

added time.sleep function to pause
Source Link
RyanKDalton
  • 23.2k
  • 17
  • 112
  • 180

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != "True":
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = "True"
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

Or you might look at the http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000024000000TestSchemaLock function and try something along the lines of

import arcpy, time
lockTest = arcpy.TestSchemaLock(featureClass)

while lockTest != "True":
  pause time.sleep(10 sec)
  lockTest = arcpy.TestSchemaLock(featureClass)

funcCopyData()

def funcCopyData():
  ...
  ...

I've never used the TestSchemaLock though, so I make no guarantees, but it sounds like it might meet what you are needing.

Hope it helps, edits/corrections welcome.

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != "True":
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = "True"
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

Or you might look at http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000024000000 and try something along the lines of

lockTest = arcpy.TestSchemaLock(featureClass)

while lockTest != "True":
  pause 10 sec
  lockTest = arcpy.TestSchemaLock(featureClass)

funcCopyData()

def funcCopyData():
  ...
  ...

I've never used the TestSchemaLock though, so I make no guarantees, but it sounds like it might meet what you are needing.

Hope it helps, edits/corrections welcome.

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != "True":
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = "True"
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

Or you might look at the TestSchemaLock function and try something along the lines of

import arcpy, time
lockTest = arcpy.TestSchemaLock(featureClass)

while lockTest != "True":
  time.sleep(10)
  lockTest = arcpy.TestSchemaLock(featureClass)

funcCopyData()

def funcCopyData():
  ...
  ...

I've never used the TestSchemaLock though, so I make no guarantees, but it sounds like it might meet what you are needing.

Hope it helps, edits/corrections welcome.

added alternate code using different function
Source Link
John
  • 3.9k
  • 13
  • 17

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != "True":
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = "True"
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

Or you might look at http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000024000000 and try something along the lines of

lockTest = arcpy.TestSchemaLock(featureClass)

while lockTest != "True":
  pause 10 sec
  lockTest = arcpy.TestSchemaLock(featureClass)

funcCopyData()

def funcCopyData():
  ...
  ...

I've never used the TestSchemaLock though, so I make no guarantees, but it sounds like it might meet what you are needing.

Hope it helps, edits/corrections welcome.

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != "True":
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = "True"
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

edits/corrections welcome.

Ok, let me start this with I am no python expert, so there are probably much more efficient ways to accomplish this, but... the first thought that comes to me would be maybe something along the lines of the following (pseudo code below)

while success != "True":
  funcCopyData()

def funcCopyData():
  try
    ...
    ...
    global var success = "True"
  except
    pause 10 sec

I don't know if that would work correctly or not as I don't know if the except would escape the while loop... but hopefully that at least gives you a thought.

Or you might look at http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000024000000 and try something along the lines of

lockTest = arcpy.TestSchemaLock(featureClass)

while lockTest != "True":
  pause 10 sec
  lockTest = arcpy.TestSchemaLock(featureClass)

funcCopyData()

def funcCopyData():
  ...
  ...

I've never used the TestSchemaLock though, so I make no guarantees, but it sounds like it might meet what you are needing.

Hope it helps, edits/corrections welcome.

Source Link
John
  • 3.9k
  • 13
  • 17
Loading