Skip to main content
Post Closed as "Not suitable for this site" by PolyGeo
deleted 699 characters in body
Source Link

My code is as follows:

    for foundFile in tables:
    foundName = foundFile.split('.')[-1]
    foundPath = os.path.join (output_fgdb_path, foundName)
    if not arcpy.Exists(foundPath):
        # Convert tables to FGDB
        try:
            print 'Attempting to convert: ' + foundName
            logging.info ('Attempting to convert: ' + foundName)
            arcpy.TableToGeodatabase_conversion(foundFile, output_fgdb_path)
            logging.info ('Finished converting: ' + foundName)

        except arcpy.ExecuteError:
            arcpy.AddError(arcpy.GetMessages(2))

        except:
            e = sys.exc_info()[1]
            print(e.args[0])

Essentially, I have one table in my database that is not able to convert into my FGDB. When I run on command line, I am able to get an error message of:

WARNING: Failed to convert Database Connections\DB.sde\Tablexxx. ERROR 999999: Error executing function.

Failed to execute (CopyRows).

But i am not able to print/write this error message to console (via print statement) or to a log file (via log.write). It seems that in my code, the except statements are not even being reached, even though an error is occuring?

My code is as follows:

    for foundFile in tables:
    foundName = foundFile.split('.')[-1]
    foundPath = os.path.join (output_fgdb_path, foundName)
    if not arcpy.Exists(foundPath):
        # Convert tables to FGDB
        try:
            print 'Attempting to convert: ' + foundName
            logging.info ('Attempting to convert: ' + foundName)
            arcpy.TableToGeodatabase_conversion(foundFile, output_fgdb_path)
            logging.info ('Finished converting: ' + foundName)

        except arcpy.ExecuteError:
            arcpy.AddError(arcpy.GetMessages(2))

        except:
            e = sys.exc_info()[1]
            print(e.args[0])

Essentially, I have one table in my database that is not able to convert into my FGDB. When I run on command line, I am able to get an error message of:

WARNING: Failed to convert Database Connections\DB.sde\Tablexxx. ERROR 999999: Error executing function.

Failed to execute (CopyRows).

But i am not able to print/write this error message to console (via print statement) or to a log file (via log.write). It seems that in my code, the except statements are not even being reached, even though an error is occuring?

My code is as follows:

Essentially, I have one table in my database that is not able to convert into my FGDB. When I run on command line, I am able to get an error message of:

WARNING: Failed to convert Database Connections\DB.sde\Tablexxx. ERROR 999999: Error executing function.

Failed to execute (CopyRows).

But i am not able to print/write this error message to console (via print statement) or to a log file (via log.write). It seems that in my code, the except statements are not even being reached, even though an error is occuring?

edited tags; edited title; added 10 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Can't print an Printing error message to console or a log file in ArcpyArcPy?

My code is as follows:

    for foundFile in tables:
    foundName = foundFile.split('.')[-1]
    foundPath = os.path.join (output_fgdb_path, foundName)
    if not arcpy.Exists(foundPath):
        # Convert tables to FGDB
        try:
            print 'Attempting to convert: ' + foundName
            logging.info ('Attempting to convert: ' + foundName)
            arcpy.TableToGeodatabase_conversion(foundFile, output_fgdb_path)
            logging.info ('Finished converting: ' + foundName)

        except arcpy.ExecuteError:
            arcpy.AddError(arcpy.GetMessages(2))

        except:
            e = sys.exc_info()[1]
            print(e.args[0])

Essentially, I have one table in my database that is not able to convert into my FGDB. When I run on command line, I am able to get an error message of: "WARNING: Failed to convert Database Connections\DB.sde\Tablexxx. ERROR 999999: Error executing function. Failed to execute (CopyRows).

WARNING: Failed to convert Database Connections\DB.sde\Tablexxx. ERROR 999999: Error executing function.

Failed to execute (CopyRows).

But i am not able to print/write this error message to console (via print statement) or to a log file (via log.write). It seems that in my code, the except statements are not even being reached, even though an error is occuring?

Can't print an error message to console or a log file in Arcpy

My code is as follows:

    for foundFile in tables:
    foundName = foundFile.split('.')[-1]
    foundPath = os.path.join (output_fgdb_path, foundName)
    if not arcpy.Exists(foundPath):
        # Convert tables to FGDB
        try:
            print 'Attempting to convert: ' + foundName
            logging.info ('Attempting to convert: ' + foundName)
            arcpy.TableToGeodatabase_conversion(foundFile, output_fgdb_path)
            logging.info ('Finished converting: ' + foundName)

        except arcpy.ExecuteError:
            arcpy.AddError(arcpy.GetMessages(2))

        except:
            e = sys.exc_info()[1]
            print(e.args[0])

Essentially, I have one table in my database that is not able to convert into my FGDB. When I run on command line, I am able to get an error message of: "WARNING: Failed to convert Database Connections\DB.sde\Tablexxx. ERROR 999999: Error executing function. Failed to execute (CopyRows). But i am not able to print/write this error message to console (via print statement) or to a log file (via log.write). It seems that in my code, the except statements are not even being reached, even though an error is occuring?

Printing error message to console or log file in ArcPy?

My code is as follows:

    for foundFile in tables:
    foundName = foundFile.split('.')[-1]
    foundPath = os.path.join (output_fgdb_path, foundName)
    if not arcpy.Exists(foundPath):
        # Convert tables to FGDB
        try:
            print 'Attempting to convert: ' + foundName
            logging.info ('Attempting to convert: ' + foundName)
            arcpy.TableToGeodatabase_conversion(foundFile, output_fgdb_path)
            logging.info ('Finished converting: ' + foundName)

        except arcpy.ExecuteError:
            arcpy.AddError(arcpy.GetMessages(2))

        except:
            e = sys.exc_info()[1]
            print(e.args[0])

Essentially, I have one table in my database that is not able to convert into my FGDB. When I run on command line, I am able to get an error message of:

WARNING: Failed to convert Database Connections\DB.sde\Tablexxx. ERROR 999999: Error executing function.

Failed to execute (CopyRows).

But i am not able to print/write this error message to console (via print statement) or to a log file (via log.write). It seems that in my code, the except statements are not even being reached, even though an error is occuring?

Source Link

Can't print an error message to console or a log file in Arcpy

My code is as follows:

    for foundFile in tables:
    foundName = foundFile.split('.')[-1]
    foundPath = os.path.join (output_fgdb_path, foundName)
    if not arcpy.Exists(foundPath):
        # Convert tables to FGDB
        try:
            print 'Attempting to convert: ' + foundName
            logging.info ('Attempting to convert: ' + foundName)
            arcpy.TableToGeodatabase_conversion(foundFile, output_fgdb_path)
            logging.info ('Finished converting: ' + foundName)

        except arcpy.ExecuteError:
            arcpy.AddError(arcpy.GetMessages(2))

        except:
            e = sys.exc_info()[1]
            print(e.args[0])

Essentially, I have one table in my database that is not able to convert into my FGDB. When I run on command line, I am able to get an error message of: "WARNING: Failed to convert Database Connections\DB.sde\Tablexxx. ERROR 999999: Error executing function. Failed to execute (CopyRows). But i am not able to print/write this error message to console (via print statement) or to a log file (via log.write). It seems that in my code, the except statements are not even being reached, even though an error is occuring?