TypeError: coercing to Unicode: need string or buffer, dict found in python
<p>This is my code for boto3. I am getting a yaml output in AS. I am not able to figure out this error. What's wrong in my code. Thanks for help. </p>

<pre><code>doc = '' 
AS = conn.describe_auto_scaling_instances(InstanceIds=[i.id])
with open(AS,'r') as file:
    doc = yaml.load(file)
    print doc
</code></pre>

<p>Error:</p>

<pre><code>Traceback (most recent call last):  
  File "C:/Users/mvadaria/PycharmProjects/lambdaEC2/ec2autoshutAS.py", line 21,   in &lt;module&gt;  
    with open(AS,'r') as file:  
TypeError: coercing to Unicode: need string or buffer, dict found  
</code></pre>