pygame.error:无法在此数据源中查找

时间:2015-03-22 16:38:23

标签: python pygame

大家好我收到以下错误;

pygame.error: Can't seek in this data source

追溯如下;

    Traceback (most recent call last):
  File "F:/Source Code/Python/graphicalSlotMachine/Main.py", line 6, in <module>
    class Main:
  File "F:/Source Code/Python/graphicalSlotMachine/Main.py", line 7, in Main
    fruity = Machine.fruitMachine()
  File "F:\Source Code\Python\graphicalSlotMachine\net\Toby\GSM\Machine.py", line 51, in __init__
    self.splash()
  File "F:\Source Code\Python\graphicalSlotMachine\net\Toby\GSM\Machine.py", line 68, in splash
    self.fruitMachine()
  File "F:\Source Code\Python\graphicalSlotMachine\net\Toby\GSM\Machine.py", line 121, in fruitMachine
    chris = Fruit.Fruit(reelGroup3, 3, random.randint(1, 4))
  File "F:\Source Code\Python\graphicalSlotMachine\net\Toby\GSM\Fruit.py", line 29, in __init__
    self.image = pygame.image.load(self.picture).convert_alpha()
pygame.error: Can't seek in this data source

和导致代码的行是;

 self.image = pygame.image.load(self.picture).convert_alpha()

1 个答案:

答案 0 :(得分:0)

您正在加载已加载的图片,如上面的评论所示:

self.picture = pygame.image.load(self.imageOne)
self.image = pygame.image.load(self.picture)

请将您的字符串与图像处理程序区分开来,不要将其加载。