<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ERROR 000301: The workspace is of the wrong type in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153878#M11890</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Either of these SE discussions helpful?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/151946/reconcileversions-tool-yields-error-000301" title="https://gis.stackexchange.com/questions/151946/reconcileversions-tool-yields-error-000301"&gt;arcpy - ReconcileVersions tool yields ERROR 000301 - Geographic Information Systems Stack Exchange&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/248182/workspace-error-type-000301-for-reconcile-version" title="https://gis.stackexchange.com/questions/248182/workspace-error-type-000301-for-reconcile-version"&gt;arcpy - Workspace Error type- 000301 for reconcile version - Geographic Information Systems Stack Exchange&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Jul 2017 17:32:27 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2017-07-19T17:32:27Z</dc:date>
    <item>
      <title>ERROR 000301: The workspace is of the wrong type</title>
      <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153872#M11884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This script is far from perfect, but I'm getting a very strange error message and I was hopeful someone could help me solve the issue. Thank You for your time:&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 000301: The workspace is of the wrong type&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;import arcpy&lt;BR /&gt;import sys&lt;BR /&gt;import os&lt;BR /&gt;import time, datetime&lt;BR /&gt;#import pyodbc&lt;BR /&gt;import traceback&lt;/P&gt;&lt;P&gt;# &lt;A&gt;\\\\Constant&lt;/A&gt; Vars\\\\&lt;BR /&gt;# Database Connection&lt;BR /&gt;editDB ="Database Connections/EdnaRoad_Admin.sde"&lt;BR /&gt;# Current Day&lt;BR /&gt;Day = time.strftime("%m-%d-%Y", time.localtime())&lt;BR /&gt;# Current Time&lt;BR /&gt;Time = time.strftime("%I:%M:%S %p", time.localtime())&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# &lt;A&gt;\\\\pyodbc.connect&lt;/A&gt; vars\\\\&lt;BR /&gt;#sqlsvrname = 'gisavglis'&lt;BR /&gt;#sqldbname = 'Arden'&lt;BR /&gt;loggingTableName = "dbo.PYTHON_SCRIPT_LOGGING"&lt;/P&gt;&lt;P&gt;# Set workspace&lt;BR /&gt;workspace = editDB&lt;/P&gt;&lt;P&gt;# Set the workspace environment&lt;BR /&gt;arcpy.env.workspace = workspace&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;def log_messages(scriptName,Status, ErrorCode):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; runDate = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; egdb_conn = arcpy.ArcSDESQLExecute(workspace) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sql = "INSERT INTO {4} (ScriptName,RunDate,Status,ErrorCode) VALUES ('{0}','{1}','{2}','{3}')".format(scriptName, runDate, Status, ErrorCode, loggingTableName)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; egdb_conn.startTransaction()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Attempt to execute SQL Statement: {0}".format(sql))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; egdb_return = egdb_conn.execute(sql)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; egdb_conn.commitTransaction()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception as err:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(err)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; egdb_return = False&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Start Time&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Process Started at ' + str(Day) + " " + str(Time)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # block new connections to the working and prod database.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Blocking Connections..."&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AcceptConnections(editDB, False)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # disconnect all users from the working and prod database.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Disconnecting Users..."&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DisconnectUser(editDB, "ALL")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get a list of all versions besides QAQC and DEFAULT to pass into the ReconcileVersions tool.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ver1List = [ver1.name for ver1 in arcpy.da.ListVersions(editDB) if ver1.name != 'DBO.Quality Control' and ver1.name != 'dbo.DEFAULT']&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Execute the ReconcileVersions tool with QAQC Target Version then delete all versions besides QAQC&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Reconcile/post versions to Quality Control...."&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ReconcileVersions_management(editDB, "ALL_VERSIONS", "DBO.Quality Control", ver1List, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Extract QAQC version from the list of versions to pass to ReconcileVersions tool.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ver2List = [ver2.name for ver2 in arcpy.da.ListVersions(editDB) if ver2.name == 'DBO.Quality Control']&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Execute the ReconcileVersions tool with DEFAULT Target Version and delete QAQC version&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Reconcile/post Quality Control to DEFAULT..."&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ReconcileVersions_management(editDB, "ALL_VERSIONS", "dbo.DEFAULT", ver2List, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("==============================")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("Unregister Tables Started")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("==============================")&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; **** wildcards for tables I don't want to include ****&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for tbs in [tb for tb in arcpy.ListTables() if '_log' not in tb and 'GenerateId' not in tb and 'PYTHON_SCRIPT' not in tb]:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print tbs&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.UnregisterAsVersioned_management(tbs,"NO_KEEP_EDIT","COMPRESS_DEFAULT")&lt;/P&gt;&lt;P&gt;# If you want to include all tables in the database use this instead:&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp; for tbs in arcpy.ListTables():&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print tbs&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.UnregisterAsVersioned_management(tbs,"NO_KEEP_EDIT","COMPRESS_DEFAULT")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("==============================")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("Unregister Feature Classes is started")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("==============================")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datasets = arcpy.ListDatasets("*", "Feature")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dataset in datasets:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcList = arcpy.ListFeatureClasses("*","",dataset)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcList:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.UnregisterAsVersioned_management(fc,"NO_KEEP_EDIT","COMPRESS_DEFAULT")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Run the compress tool.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Compressing database..."&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Compress_management(editDB)&lt;/P&gt;&lt;P&gt;# &lt;A&gt;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&lt;/A&gt; script initiation, Rec/Post process error handling &lt;A&gt;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&lt;/A&gt;&lt;/P&gt;&lt;P&gt;except:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'An error occured'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg = '\nSCRIPT FAILURE IN SCRIPT INITIATION OR RECONCILE-POST PROCESS, \n'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg += 'Most recent GP messages below.\n'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg += arcpy.GetMessages() +'\n'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg += '\nTraceback messages below.\n'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg += traceback.format_exc().splitlines()[-1]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print failMsg&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #write error log info&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Logging error to database....'&lt;BR /&gt;# THIS SECTION FOR LOGGING ERRORS TO A DB TABLE&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; log_messages('ReconcilePost_AssetIDs_QAQC','Failure', failMsg)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit()&lt;/P&gt;&lt;P&gt;# ////////////////////////////////////// REGISTER AS VERSIONED AND RE-CREATE VERSIONS /////////////////////////////////&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("==============================")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("register tables is started")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("==============================")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; **** wildcards for tables I don't want to version ****&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for tbs in [tb for tb in arcpy.ListTables() if '_log' not in tb and 'GenerateId' not in tb and 'PYTHON_SCRIPT' not in tb]:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print tbs&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RegisterAsVersioned_management(tbs, "NO_EDITS_TO_BASE")&lt;/P&gt;&lt;P&gt;# If you want to include all tables in the database use this:&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp; for tbs in arcpy.ListTables():&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print tbs&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RegisterAsVersioned_management(tbs, "NO_EDITS_TO_BASE")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("==============================")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print ("register Feature Class is started")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("==============================")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datasets = arcpy.ListDatasets("*", "Feature")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dataset in datasets:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcList = arcpy.ListFeatureClasses("*","",dataset)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcList:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RegisterAsVersioned_management(fc, "NO_EDITS_TO_BASE")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create versions&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print "Creating Versions..."&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CreateVersion_management(editDB, 'dbo.DEFAULT', 'QAQC', 'PRIVATE')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CreateVersion_management(editDB, 'DBO.QAQC', 'MICHAEL', 'PUBLIC')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CreateVersion_management(editDB, 'DBO.QAQC', 'KAREN', 'PUBLIC')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CreateVersion_management(editDB, 'DBO.QAQC', 'COLLECTOR', 'PUBLIC')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # /////////////////////////////////// ANALYZE DATASETS AND CALC STATISTICS /////////////////////////////////////&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # NOTE: Rebuild indexes can accept a Python list of datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get a list of all the datasets the user has access to.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # First, get all the stand alone tables, feature classes and rasters.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Next, for feature datasets get all of the datasets and featureclasses&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # from the list and add them to the master list.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for dataset in arcpy.ListDatasets("*", "Feature"):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = os.path.join(workspace, dataset)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataList += arcpy.ListFeatureClasses() + arcpy.ListDatasets()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # reset the workspace&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Concatenate all datasets into a list&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datasetList = [ds for ds in dataList]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "rebuilding indexes"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Execute rebuild indexes&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Note: to use the "SYSTEM" option the workspace user must be an administrator.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RebuildIndexes_management(workspace, "SYSTEM", datasetList, "ALL")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('Rebuild Complete')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "analyzing datasets"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AnalyzeDatasets_management(workspace, "SYSTEM", datasetList, "ANALYZE_BASE", "ANALYZE_DELTA", "ANALYZE_ARCHIVE")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "analysis complete"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Allow the database to begin accepting connections again&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Set databases to allow connections..."&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AcceptConnections(editDB, True)&lt;/P&gt;&lt;P&gt;# &lt;A&gt;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&lt;/A&gt; If Script Successful, log into database &lt;A&gt;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Data has been synched succesfully and logged in the tracking database'&lt;/P&gt;&lt;P&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn = pyodbc.connect('Trusted_Connection=yes', driver='{SQL Server}', server="ggogisapp1.scwater.com", database= "Database Connections/Arden.Admin.sde, ALL")&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = conn.cursor()&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # You will need to create a table in sql to log to and add fields that you want to log into and pass them as params to this cursor&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.execute("""INSERT INTO [dbo].[PYTHON_SCRIPT_TRACKER] (ScriptName,RunDate,Status,ErrorCode) VALUES ('ReconcilePost_AssetIDs_QAQC',GetDate(),'Success','All Steps Completed Without Error'); """)&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn.commit()&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del cursor&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn.close()&lt;BR /&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Script is finished'&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# /////////////////////////////////Register as Versioned Error handling area////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;except:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'An error occured'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg = '\nSCRIPT FAILURE IN VERSIONING PROCESS\n'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg += 'Most recent GP messages below.\n'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg += arcpy.GetMessages() +'\n'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg += '\nTraceback messages below.\n'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; failMsg += traceback.format_exc().splitlines()[-1]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print failMsg&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #write error log info&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Logging error to database....'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # THIS SECTION FOR LOGGING ERRORS TO A DB TABLE&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; log_messages('ReconcilePost_AssetIDs_QAQC','Failure', failMsg)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn = pyodbc.connect('Trusted_Connection=yes', driver='{SQL Server}', server=sqlsvrname, database=sqldbname)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = conn.cursor()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #You will need to create a table in sql to log to and add fields that you want to log into and pass them as params to this cursor&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.execute("""INSERT INTO [dbo].[PYTHON_SCRIPT_TRACKER] (ScriptName,RunDate,Status,ErrorCode) VALUES ('ReconcilePost_AssetIDs_QAQC',GetDate(),'Failure',(?)); """,failMsg)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn.commit()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn.close()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit()&lt;/P&gt;&lt;P&gt;print "Script has run its course and is now complete"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jul 2017 20:15:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153872#M11884</guid>
      <dc:creator>LarryAdgate</dc:creator>
      <dc:date>2017-07-06T20:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000301: The workspace is of the wrong type</title>
      <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153873#M11885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Larry you might want to &lt;A _jive_internal="true" href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;&lt;STRONG&gt;format your code &lt;/STRONG&gt;&lt;/A&gt;it is tough to follow&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jul 2017 20:25:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153873#M11885</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-07-06T20:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000301: The workspace is of the wrong type</title>
      <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153874#M11886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;same error I am getting and my workspace is set up just like yours. weird it works on one script but one a new one it doesnt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 12:41:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153874#M11886</guid>
      <dc:creator>Lake_Worth_BeachAdmin</dc:creator>
      <dc:date>2017-07-19T12:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000301: The workspace is of the wrong type</title>
      <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153875#M11887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Joe for your response, yes it is a very strange Error and frustrating-Any solutions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 15:11:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153875#M11887</guid>
      <dc:creator>LarryAdgate</dc:creator>
      <dc:date>2017-07-19T15:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000301: The workspace is of the wrong type</title>
      <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153876#M11888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What part of the code is generating the error?&amp;nbsp; When debugging, I find it most effective to remove try:except statements so you can see exactly where the code is failing and the stack information.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 16:58:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153876#M11888</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-07-19T16:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000301: The workspace is of the wrong type</title>
      <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153877#M11889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for me its the arcpy.ReconcileVersions_management command. there error is&amp;nbsp;&lt;/P&gt;&lt;P&gt;ExecuteError: ERROR 000301: The workspace is of the wrong type&lt;BR /&gt;Failed to execute (ReconcileVersions).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153877#M11889</guid>
      <dc:creator>Lake_Worth_BeachAdmin</dc:creator>
      <dc:date>2017-07-19T17:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000301: The workspace is of the wrong type</title>
      <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153878#M11890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Either of these SE discussions helpful?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/151946/reconcileversions-tool-yields-error-000301" title="https://gis.stackexchange.com/questions/151946/reconcileversions-tool-yields-error-000301"&gt;arcpy - ReconcileVersions tool yields ERROR 000301 - Geographic Information Systems Stack Exchange&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/248182/workspace-error-type-000301-for-reconcile-version" title="https://gis.stackexchange.com/questions/248182/workspace-error-type-000301-for-reconcile-version"&gt;arcpy - Workspace Error type- 000301 for reconcile version - Geographic Information Systems Stack Exchange&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:32:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153878#M11890</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-07-19T17:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 000301: The workspace is of the wrong type</title>
      <link>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153879#M11891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; font-size: 13px;"&gt;&lt;TBODY style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;TD class="" style="border: 0px; font-weight: inherit; font-size: inherit; padding: 0px 15px 0px 0px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;SPAN class="" style="color: #6a737c; border: 0px; font-weight: inherit; font-size: 20px; margin: 8px 0px;"&gt;0&lt;/SPAN&gt;&lt;A style="color: #358daa; border: 0px; font-weight: inherit; text-decoration: none; text-indent: -9999em; font-size: 1px; margin: 0px auto 10px;" title="This answer is not useful"&gt;down vote&lt;/A&gt;&lt;A data-title-accept="Click to accept this answer because it solved your problem or was the most helpful in finding your solution (click again to undo)" data-title-unaccept="Click to undo acceptance of this answer; you accepted this answer " data-verb-accept="accept" data-verb-unaccept="unaccept" style="color: #358daa; border: 0px; font-weight: inherit; text-decoration: none; text-indent: -9999em; font-size: 1px; margin: 0px auto 10px;" title="Click to accept this answer because it solved your problem or was the most helpful in finding your solution (click again to undo)"&gt;accept&lt;/A&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;TD class="" style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; margin: 0px 0px 5px;"&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit; margin: 0px 0px 1em;"&gt;I found out what was causing my error.&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit; margin: 0px 0px 1em;"&gt;The 2 versions I am working with (parent and child) were created by another user of the SDE(not admin).&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit; margin: 0px 0px 1em;"&gt;This caused the version names to be formatted differently rather than the norm "sde.version_name". In this case part of the version name is formatted as follows&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;"domain\username".version_name&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;so since this is a string parameter you must enter it as:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG style="border: 0px; font-weight: bold; font-size: inherit;"&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; font-size: 13px; padding: 1px 5px;"&gt;'"domain\username".version_name'&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2017 17:34:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-000301-the-workspace-is-of-the-wrong-type/m-p/153879#M11891</guid>
      <dc:creator>Lake_Worth_BeachAdmin</dc:creator>
      <dc:date>2017-07-19T17:34:30Z</dc:date>
    </item>
  </channel>
</rss>

