Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`NameError: 'GL_V3F' is not defined when using pywavefront with PyOpenGL #2

Open
danilorassis opened this issue May 10, 2024 · 2 comments

Comments

@danilorassis
Copy link

danilorassis commented May 10, 2024

Issue Description

Environment:

  • Operating System: [buntu 22.04.4 LTS]
  • Python Version: [3.10.12]
  • PyOpenGL Version: [3.1.7]
  • pywavefront Version: [1.3.3]

Problem:
I am encountering a NameError when attempting to use the pywavefront library, specifically when it tries to access GL_V3F from PyOpenGL. When execute 3_visualise.py. The exact error message is:

Traceback (most recent call last):
  File "/home/ubuntu/murt/examples/3_visualise.py", line 2, in <module>
    from murt.window import Window
  File "/usr/local/lib/python3.10/dist-packages/murt/window/__init__.py", line 1, in <module>
    from .mwindow as MurtWindow as Window
  File "/usr/local/lib/python3.10/dist-packages/murt/window/mwindow.py", line 8, in <module>
    from pywavefront import visualization, Wavefront, configure_logging
  File "/home/ubuntu/.local/lib/python3.10/site-packages/pywavefront/visualization.py", line 48, in <module>
    'V3F': GL_V3F,
NameError: name 'GL_V3F' is not defined

Steps to Reproduce:

  1. Install PyOpenGL and pywavefront via pip.
  2. Run a script that initializes an object from pywavefront which triggers the use of OpenGL constants.
  3. The script crashes with the mentioned NameError.

Attempts to Resolve:

  • I have tried reinstalling both PyOpenGL and pywavefront.
  • Checked for any updates or dependency issues with both libraries.
  • Attempted to manually define the variable or modify the environment to bypass the error.

None of the above steps have resolved the issue. I suspect there might be an issue with how constants are being imported or used within the PyOpenGL or perhaps a recent update might have altered something.

Expected Outcome:
The script should execute without throwing a NameError and should correctly utilize the constants from PyOpenGL.

Any guidance or recommendations on how to fix this issue would be greatly appreciated. If there is any additional information I can provide, please let me know. Thank you in advance for your help!

@tamsri tamsri assigned tamsri and unassigned tamsri May 14, 2024
@tamsri
Copy link
Owner

tamsri commented May 14, 2024

@danilorassis I found a related issue from this dependency package pywavefront/PyWavefront#149. Maybe you can try to reduce your pyglet version to 1.5.x? I haven't checked this project for some time, I will take a look and update some dependencies. :)

@danilorassis
Copy link
Author

Hi,

I was facing the error NameError: 'GL_V3F' is not defined when using pywavefront with PyOpenGL. With the community's help, I managed to resolve the issue by following these steps:

  1. Uninstalled the current versions of the related libraries:

    pip uninstall pywavefront PyOpenGL pyglet
  2. Reinstalled pyglet version 1.5.x:

    pip install pyglet==1.5.21
  3. Reinstalled pywavefront and PyOpenGL:

    pip install pywavefront PyOpenGL

After this, I encountered an additional error: FileNotFoundError: [Errno 2] No such file or directory: '/usr/murt-assets/ground.obj'. To resolve this, I checked if the ground.obj file was present in the specified path. Since the file was not in the expected location, I adjusted the path in my Python code to point to the correct location of the file. Here's what I did:

  1. Manually checked if the ground.obj file was present in the /usr/murt-assets/ path:

    ls /usr/murt-assets/ground.obj
  2. Adjusted the path in the Python code in the file /usr/local/lib/python3.10/dist-packages/murt/window/mwindow.py:

    'ground': Wavefront(os.path.join("/correct/path/to/file/", "ground.obj"), collect_faces=True),

After these modifications, the script worked correctly. I hope this helps others who might be facing similar issues.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants