<?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: ListVersions: Not a valid SDE workspace. in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704523#M23359</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's worth noting here that arcpy.ListFeatureClasses() works as expected when I put that ahead of ListVersions in the code above.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Oct 2011 18:47:21 GMT</pubDate>
    <dc:creator>DanNarsavage</dc:creator>
    <dc:date>2011-10-05T18:47:21Z</dc:date>
    <item>
      <title>ListVersions: Not a valid SDE workspace.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704522#M23358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've been beating my head against a wall for a couple days now &amp;amp; it's past time for me to ask for help.&amp;nbsp; I've got a script that I run from the command prompt that I want (among other things) to get a list of all versions in an SDE instance, loop through that list looking for a version with a particular name, and delete that version if it exists.&amp;nbsp; The code I wrote is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
ParentConnection = "C:\\temp\\Basemap_Default_DC1.sde\\"&amp;nbsp; ## Actually set programmatically but this is what's pumped into my function
ParentConnection = ParentConnection.rstrip("\\")
arcpy.env.workspace = ParentConnection
VersionList = arcpy.ListVersions()
## arcpy.ListVersions(ParentConnection) yielded the same results 
for name in VersionList:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if name.endswith("." + VersionName):&amp;nbsp;&amp;nbsp;&amp;nbsp; ## If a version with this name already exists then delete it
&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; arcpy.DeleteVersion_management(ParentConnection, name)
&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; break
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I call arcpy.ListVersions() (regardless of scope or the two different ways to specify the workspace as noted above), I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Traceback (most recent call last):
&amp;nbsp; File "R:\Addressing\QualityControl\PythonFiles\CountywideNearAnalysis.py", line 121, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; raise inst
ValueError: ListVersions: Not a valid SDE workspace.
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone shed some light on this?&amp;nbsp; The sde file exists and works correctly in ArcCatalog, furthermore this same code works in ArcCatalog's Python window.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 18:42:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704522#M23358</guid>
      <dc:creator>DanNarsavage</dc:creator>
      <dc:date>2011-10-05T18:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: ListVersions: Not a valid SDE workspace.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704523#M23359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's worth noting here that arcpy.ListFeatureClasses() works as expected when I put that ahead of ListVersions in the code above.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 18:47:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704523#M23359</guid>
      <dc:creator>DanNarsavage</dc:creator>
      <dc:date>2011-10-05T18:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: ListVersions: Not a valid SDE workspace.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704524#M23360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dan, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Typically this message indicates that Python/ArcPy was not able to connect to the database. Double check that that specific connection file can be used to connect to the database. If you are using 3-tier (application server) connections double check that the service is running. If you are creating the connection file in the script, ensure that you are providing the correct username/password/version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know what you are doing earlier on in your script but I have seen some issues where the workspace gets cached and this prevents the connection from succeeding. Try running ClearWorkspaceCache_management prior to what you have provided and see if that helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You should be using this syntax:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.ListVersions(ParentConnection)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was able to run your code on my machine and get a list of versions without issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 13:44:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704524#M23360</guid>
      <dc:creator>RussellBrennan</dc:creator>
      <dc:date>2011-10-06T13:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: ListVersions: Not a valid SDE workspace.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704525#M23361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Russell.&amp;nbsp; But as I said, the sde file exists and works correctly in ArcCatalog.&amp;nbsp; It even works correctly immediately before I try ListVersions--I put an extraneous ListFeatureClasses in my script immediately before the ListVersions.&amp;nbsp; The ListFeatureClasses succeeded and I was able to print the resulting list, then ListVersions crashed the script with the error message I posted earlier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do create the connection file earlier in the script and it works to retrieve several feature classes. In fact one of these feature classes is used in two "arcpy.Near_analysis" analyses that finish mere seconds before this ListVersions fails. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We use OS authentication here, so the username &amp;amp; password properties are both hard-coded to "#."&amp;nbsp; But the connection *WORKS*, both earlier in the script and manually after the script bombs, so I highly doubt that's the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm almost sure that I've tried clearing the workspace cache before without success, but trying it again . . . watch it work this time . . . to be continued tomorrow . . .&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 21:44:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704525#M23361</guid>
      <dc:creator>DanNarsavage</dc:creator>
      <dc:date>2011-10-06T21:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: ListVersions: Not a valid SDE workspace.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704526#M23362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sure enough, clearing the workspace cache worked.&amp;nbsp; Thanks Russell!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Oct 2011 14:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704526#M23362</guid>
      <dc:creator>DanNarsavage</dc:creator>
      <dc:date>2011-10-07T14:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: ListVersions: Not a valid SDE workspace.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704527#M23363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No problem, I am pleased that this worked for you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 15:52:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/listversions-not-a-valid-sde-workspace/m-p/704527#M23363</guid>
      <dc:creator>RussellBrennan</dc:creator>
      <dc:date>2011-10-10T15:52:10Z</dc:date>
    </item>
  </channel>
</rss>

