get infinity input PIL (python)
<p>I'm writing a program that converts image to png and converts size to 512,
I want to get more input. </p>

<pre><code>from PIL import Image
import string
import random

put = input("enter your image path:")
im = Image.open(put)
size = (512,512)

if im.size &gt; size:
        im.thumbnail(size,Image.ANTIALIAS)    
else:
       print ("it's ready")

ranam = (''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(12)))
name = "d:/arjang/images/" + ranam

im.save(name + ".png")
</code></pre>

<p>Please help.</p>

<p>You have been mislead by the "input() function. Its does not do what you would hope a function called input will do. input executes what you type as code.</p>

<p>This is so misleading that python3 changed "input()" to do the obvious and removed raw_input().</p>

<p>To read a line from the standard input you can use this in python2:</p>

<pre><code>put = raw_input("enter your image path:")
</code></pre>

<p>or you could do this:</p>

<pre><code>import sys

sys.stdout.write("enter your image path:")
sys.atdout.flush()
put = sys.stdin.readline().strip()
</code></pre>

python input python-imaging-library pillow