<?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: Cannot connect to SDE in Commande line using Arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498381#M39122</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;sorry i've marked this thread as solved by mistake , i'm steel looking for a solution , thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jun 2012 08:49:21 GMT</pubDate>
    <dc:creator>geogeekgeogeek</dc:creator>
    <dc:date>2012-06-25T08:49:21Z</dc:date>
    <item>
      <title>Cannot connect to SDE in Commande line using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498380#M39121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;While I'm inside ArcMap 10, the Python window gives me all output correctly, like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.env.workspace = r"C:\uber.gdb"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.ListDatasets("*","ALL")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[u'uberlandia_urbano', u'Idw_pop2006', u'Idw_pop2000']&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But, if I open cmd window (Run &amp;gt; cmd) and type the exact same commands, it will give me an empty list as a result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm pretty sure that the Python version used is the one tied up with arcgis, since I can import arcpy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any chance that arcpy does not work on the standard python console?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2012 07:16:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498380#M39121</guid>
      <dc:creator>geogeekgeogeek</dc:creator>
      <dc:date>2012-06-25T07:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SDE in Commande line using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498381#M39122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;sorry i've marked this thread as solved by mistake , i'm steel looking for a solution , thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2012 08:49:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498381#M39122</guid>
      <dc:creator>geogeekgeogeek</dc:creator>
      <dc:date>2012-06-25T08:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SDE in Commande line using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498382#M39123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;i can get the name of geodatabase by arcpy.Describe(arcpy.env.workspace).name but i get an empty array using&amp;nbsp; arcpy.ListDatasets("*","ALL")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2012 10:40:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498382#M39123</guid>
      <dc:creator>geogeekgeogeek</dc:creator>
      <dc:date>2012-06-25T10:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SDE in Commande line using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498383#M39124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you want to force something to the console, try something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, sys
arcpy.env.workspace = r"C:\Temp\BackgroundData_fGDB.gdb"
fcList = arcpy.ListFeatureClasses("*", "ALL")
for fc in fcList:
&amp;nbsp;&amp;nbsp; sys.stdout.write(b +"\n")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:53:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498383#M39124</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-12-11T21:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SDE in Commande line using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498384#M39125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;i've found a workaround to package the script in a tool, then call it from Arcobjects like this &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; IGeoProcessor2 gp = new GeoProcessorClass();
 gp.AddToolbox(@"C:\YourPath\YourToolbox.tbx");
 parameters.Add(@"C:\YourPath\ParamsIfYouHaveThem.gdb\ParamFC");
 gp.Execute("NameOfYourToolInsideReferencedToolbox", parameters, null);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but i would like to know why i can't run Arcpy scripts correcltly, why i get an empty array when calling arcpy.ListFeatureClasses() after setting the workspace to the geodatabase path, when working in the commande line?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i'm using win 7 64bit , Arcgis suite 10 (Desktop, engine , server)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:53:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498384#M39125</guid>
      <dc:creator>geogeekgeogeek</dc:creator>
      <dc:date>2021-12-11T21:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SDE in Commande line using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498385#M39126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi geogeek14,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When working with either an SDE geodatabase or a file geodatabase, ListDatasets("*","ALL") returned all the Feature Datasets in the geodatabase when run in the Python Window, from the command prompt (using the code snippet from posting #4), or from the command prompt inside Python. I tested the ListDatasets() function, and reproduced an empty list only if the geodatabase had no Feature Datasets. Does your geodatabase contain any Feature Dataset objects? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to get the Feature Classes within each Feature Dataset, ListFeatureClasses("*","","&amp;lt;Feature Dataset Name&amp;gt;") returned the feature classes. ListFeatureClasses() should return any stand-alone geodatabase feature classes if no Feature Dataset is specified. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In post #3 I'm seeing the results of ListDatasets() questioned, and in post #5 I'm seeing the results of ListFeatureClasses() quesitioned.&amp;nbsp; If you're getting an empty list with ListDatasets(), it could be that there are no Feature Datasets within the geodatabase. If you're getting an empty list with ListFeatureClasses() in a geodatabase with known feature classes, there's more troubleshooting to look into. Let me know if you're seeing that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;John&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2012 19:42:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498385#M39126</guid>
      <dc:creator>JohnYaist1</dc:creator>
      <dc:date>2012-06-27T19:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot connect to SDE in Commande line using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498386#M39127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi John,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i'm sorry if my posts were not so clearly explained, i've made a mistake in the early posts i meant&amp;nbsp; ListFeatureClasses(), i tested this function in Python window in Arcmap it gimme all the feature classes , and i haven't datasets in the geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so the code that wrote in the python commande line :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;import arcpy 
&amp;gt;&amp;gt;arcpy.env.workspace = u'C:\\Users\\hp\\Documents\\ArcGIS\\Default.gdb'
&amp;gt;&amp;gt;arcpy.ListFeatureClasses()
&amp;gt;&amp;gt;[]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when i execute the same code in Arcmap python window i get all the feature classes of the geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i've made sure if have a problem in setting the global variables in windows 7:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PYTHONPATH = C:\Program Files (x86)\ArcGIS\Desktop10.0\bin;C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy;C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the concerned part from PATH = C:\Python26\ArcGIS10.0;C:\Python26\ArcGIS10.0\Scripts;C:\Program Files (x86)\ArcGIS\ArcSDE\pgexe\bin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot for your answer and available for any details&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:53:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-connect-to-sde-in-commande-line-using-arcpy/m-p/498386#M39127</guid>
      <dc:creator>geogeekgeogeek</dc:creator>
      <dc:date>2021-12-11T21:53:59Z</dc:date>
    </item>
  </channel>
</rss>

