-1

This is my code. When I am running the code it says syntax error = invalid syntax, it sees "&" symbol as a invalid syntax.

enter code here
# -*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import time
import os
buttonPin = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(buttonPin,GPIO.IN)
while True:
if (GPIO.input(buttonPin)):
     os.system("fswebcam -r -d 
      /dev/video0/home/pi/webcam.jpg")         
    os.system("python /home/pi/mailgonder.py")
Stephen Docy
  • 4,738
  • 7
  • 18
  • 31

1 Answers1

0

The code inside your while loop is not indented properly, and os.system arguments should be in quotes.

MrKagouris
  • 106
  • 1
  • 8
  • yes i tried " use this it didnt show syntax error like when i code like this ("fswebcam......") it runs and take photo but how can i use " ? – Mehmet Emin Dağ Apr 18 '18 at 10:57
  • " is an HTML character escape and is not useful for terminal commands. In all likelihood copying the text from an HTML source (website or something) resulted in you getting those character escapes in the string. **In short, " is relevant to HTML and not valid in the terminal.** – MrKagouris Apr 18 '18 at 20:08