title: How do I use a file opened by GUI in python?
body: <p>I have these lines of code:</p>
  
  <pre><code>import tkFileDialog, arcpy, arcpy.da, numpy as np, Tkinter
  import arcpy.mapping as mapping
  
  fc = tkFileDialog.askopenfilename(filetypes=[('shapefiles','*.shp')],title='Choose a Shapefile')
  print 'fc = {0}'.format(fc)
  desc = arcpy.Describe(fc)
  
  #Find the number of rows(alternatives) and print it!
  number_of_rows = arcpy.GetCount_management(fc)
  R = int(number_of_rows.getOutput(0))
  print R
  #Find the number of columns(criterias) and print it!
  C = len(arcpy.ListFields(fc))
  print C
  </code></pre>
  
  <p>It creates a GUI where I can browse and open a shapefile.<br>
  This shapefile is an ArcMap shapefile with a layer and an attribute table.<br>
  With this algorithm I get this error:</p>
  
  <blockquote>
    <p>ExecuteError: ERROR 000229: Cannot open
    C:/Users/Th/Desktop/waterways.shp</p>
    
    <p>Failed to execute (GetCount).</p>
  </blockquote>
  
  <p>How can I solve this?<br>
  Without using the GUI, I manually add to the algorithm the shapefile:</p>
  
  <pre><code>fc = "C:/Users/Th/Desktop/waterways.shp"
  </code></pre>