1
Machine:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp MacBook Pro 2018

OS:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp macOS Catalina 10.15.7
Python-Version: 3.8.2
Pygame-Version: 2.0.0

I'm currently trying to run a tower defense project written in python:
https://github.com/loinesg/tower-defence

However, when I run main.py I get the following output:

Hello from the pygame community. https://www.pygame.org/contribute.html
Error loading level
Traceback (most recent call last):
  File "/main.py", line 31, in <module>
    game = Game(window)
  File "core/game.py", line 47, in __init__
    self.load_level("path")
  File "/core/game.py", line 62, in load_level
    self.level = Level(self, name)
  File "/core/level.py", line 44, in __init__
    self.start()
  File "/core/level.py", line 73, in start
    for args in self.data:
AttributeError: 'Level' object has no attribute 'data'

This project is the basis for a group project at university this semester and I'd be really glad if I were able to run this on my main machine.

I'm not very familiar with python, yet.
My first assumption was that there are actually some grammatical errors in regards to python in there but my other group members are all able to run this project.
My next idea was that it has something to do with my python version, since the README.MD states that this project was run and tested with python-3.2. But again, my group members are able to run this just fine with python-3.7 and -3.8.
My last idea is that it has to do with my pygame version.
Unfortunately however, my machine does not support pygame versions < 2.0 so that I can not fully test this.

Can someone confirm that it has to do with my pc?
Is there a way or any suggestion on how to get this to run on my machine?
Or do I have to switch to something else?

MatMat
  • 11
  • 1
  • did you mean `self.load_data` as it is the only defined function that has some ressemblence to word `data`. Go and check `level.py` and change the name in that loop. I do not think there is any connection with your device that would be a reason for script to not run – Matiiss Oct 31 '20 at 19:34
  • @Matiiss change the name of `self.date` in the loop in line 73 in level.py? but does this loop not want to access what is stored in the instance attribute `data` which gets defined in the `load_data` function which gets called by `__init__` ? I fear I cannot completely follow. – MatMat Nov 01 '20 at 15:35
  • well in that case try defining `self.data` in `__init__` before calling any functions as an empty string or list – Matiiss Nov 01 '20 at 16:35

0 Answers0