Skip to content

Program isn't running - stacktrace included #8

@ivancosta

Description

@ivancosta

==== RESTART: D:\dados\projetos\python\3d_engine\Software_3D_engine\main.py ====
pygame 2.4.0 (SDL 2.26.4, Python 3.11.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "D:\dados\projetos\python\3d_engine\Software_3D_engine\main.py", line 49, in
app = SoftwareRender()
File "D:\dados\projetos\python\3d_engine\Software_3D_engine\main.py", line 15, in init
self.create_objects()
File "D:\dados\projetos\python\3d_engine\Software_3D_engine\main.py", line 20, in create_objects
self.object = self.get_object_from_file('resources/t_34_obj.obj')
File "D:\dados\projetos\python\3d_engine\Software_3D_engine\main.py", line 32, in get_object_from_file
return Object3D(self, vertex, faces)
File "D:\dados\projetos\python\3d_engine\Software_3D_engine\object_3d.py", line 15, in init
self.faces = np.array([np.array(face) for face in faces])
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2946,) + inhomogeneous part.

==========================================
pip show numpy

Name: numpy
Version: 1.24.3
Summary: Fundamental package for array computing in Python
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email:
License: BSD-3-Clause
Location: C:\Users\falec\AppData\Roaming\Python\Python311\site-packages
Requires:
Required-by: numba

===========================================

Modify file object_3d.py, line 15, add parameter: dtype=object like below:

self.faces = np.array([np.array(face) for face in faces], dtype=object)

This fix the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions