#๐Ÿ”’ pymunk space.remove causes an error next time i try to add a segment to the space

12 messages ยท Page 1 of 1 (latest)

noble flame
#

the code works fine to remove the poly body from the space but when i try to add a segment it says: "AttributeError: 'Poly' object has no attribute 'a'. any tips?

proper groveBOT
#

@noble flame

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

tender hull
#

Code? And adding a Poly or a Segment?

noble flame
#

should i just send the bit of code that causes the error?

#

and the error only occurs when i try to add a segment AFTER i remove any poly

tender hull
#

Ideally something runnable and the full traceback of you can

noble flame
#

i probably write the most unreadable code so ill heavily comment the parts that cause the issue

#

for now heres the traceback

#

Traceback (most recent call last):
File "c:\Users\lit4s\OneDrive\Desktop\pygunk\main.py", line 173, in <module>
pygame.draw.line(screen,[0,0,0],space.shapes[i].a,space.shapes[i].b,10)
^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\pymunk_typing_attr.py", line 13, in getattr
return self.getattribute(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Poly' object has no attribute 'a'

#

how should i send the code? its not allowing me to attatch my file

proper groveBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.