python input() not working! (raspberry pi camera program)
Question: I am on my raspberry pi making a camera program (code)

    
    
    import picamera
    import sys
    import time
    
    question=input('do you want to take a picture(pic) take a timed picture(time) or a video(vid)')
    if question=='pic':
        time=0
    elif question=='time':
        time=1
    elif question=='vid':
        print ('coming soon')
        sys.exit()
    num=0
    camera = picamera.PiCamera()
    camera.start_preview()
    input('press any key to take picture')
    if time==1 :
        print ('5')
        time.sleep(1)
        print ('4')
        time.sleep(1)
        print ('3')
        time.sleep(1)
        print ('2')
        time.sleep(1)
        print ('1')
        time.sleep(1)
        print ('0')
    camera.capture(num)
    num=num + 1
    

and when I ran it, it asked

> Do you want to take a picture(pic) take a timed picture(time) or a
> video(vid)

just as it was suppose to I replied

> pic

then it gave me this error

    
    
    Traceback (most recent call last):
       File "/home/pi/Desktop/camera.py", line 5, in <module>
       question=input('do you want to take a picture(pic) take a timed picture(time) or a video(vid)')
      File "<string>", line 1, in <module>
    NameError: name 'pic' is not defined
    

What happened?


Answer: As Cyber said in the comments, use python's raw_input() function vis-a-vis
input.

raw_input() will take anything from STDIN as a STR type until the user hits
enter.

    
    
    question = raw_input("Do you want to take a picture(pic) take a timed picture(time) or a video(vid)?")
    

