title: Pyspark IndentationError: expected an indented block
body: <p>I am attempting to send query results from pyspark.sql to a text file using the pyspark command <code>saveAsTextFile</code></p>
  
  <p>I have tried the following code to achieve this:</p>
  
  <pre><code>def main():
  #Order by sales descending
  example8 = spark.sql("""SELECT
      *
  FROM sales_info
  ORDER BY Sales DESC""")
  print.example8.collect()
  example8.saveAsTextFile("juyfd")
  
  main()
  </code></pre>
  
  <p>However, I get the following error:</p>
  
  <pre><code>Append ResultsClear Results
    File "&lt;ipython-input-25-ce236630f96f&gt;", line 3
      example8 = spark.sql("""SELECT
             ^
  IndentationError: expected an indented block
  </code></pre>
  
  <p>When I indent <code>example8</code> I get the following error:</p>
  
  <pre><code>Append ResultsClear Results
  ---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-26-337d9fc099ad&gt; in &lt;module&gt;()
        5 FROM sales_info
        6 ORDER BY Sales DESC""")
  ----&gt; 7 print.example8.collect()
        8 example8.saveAsTextFile("juyfd")
        9 
  
  AttributeError: 'builtin_function_or_method' object has no attribute 'example8'
  </code></pre>