Python 它显示SyntaxError:每当我运行代码时,在解析时出现意外的EOF

Python 它显示SyntaxError:每当我运行代码时,在解析时出现意外的EOF,python,raspberry-pi,Python,Raspberry Pi,这段代码是显示一个覆盆子圆周率感帽子的图像,请告诉我如何解决这个问题。谢谢你告诉我如何编辑代码。我按照raspberry pi网站上的说明进行操作。我正在使用sense HAT制作降临节日历,我希望它能够显示图片。在最后一行添加a) 显示图片(所有图片[7])缺少关闭)之后显示图片(所有图片[7] from sense_hat import SenseHat from time import sleep, strftime sense = SenseHat() # -------------

这段代码是显示一个覆盆子圆周率感帽子的图像,请告诉我如何解决这个问题。谢谢你告诉我如何编辑代码。我按照raspberry pi网站上的说明进行操作。我正在使用sense HAT制作降临节日历,我希望它能够显示图片。

在最后一行添加a)

显示图片(所有图片[7])

缺少关闭
之后显示图片(所有图片[7]
from sense_hat import SenseHat
from time import sleep, strftime

sense = SenseHat()

# ------------------------------------------------
# DATA
# ------------------------------------------------

# Colours
colours = {

  'r' : [255, 0, 0],
  # Add orange, yellow, green, blue, indigo, violet here
  'o' : [255, 125, 0],
  'y' : [255, 255, 0],
  'g' : [0, 255, 0],
  'b' : [0, 0, 255],
  'i' : [75, 0, 130],
  'v' : [51, 2, 170],
  'n' : [135, 80, 22],
  'w' : [255, 255, 255],
  'e' : [0, 0, 0]  # e stands for empty/black

}

# Pictures
with open("pictures.txt", "r") as f:
  all_pics = f.readlines()
# ------------------------------------------------
# FUNCTIONS
# ------------------------------------------------
# Display a given picture string on the sense HAT
# ------------------------------------------------
def display_pic(pic_string):

  # Get rid of newline and split the line into a list
  pic_string = pic_string.strip("\n")
  pic_string = pic_string.split(",")

  # Look up each letter in the dictionary of colours and add it to the list
  pic_list = []
  for letter in pic_string:
      pic_list.append(colours[letter])

  # Display the pixel colours from the file
  sense.set_pixels(pic_list)



# ------------------------------------------------
# MAIN PROGRAM
# ------------------------------------------------
sense.clear()
display_pic(all_pics[7]



it show this-----> SyntaxError: unexpected EOF while parsing