Closed lambage closed 4 years ago
We support Python 3.5, 3.6, 3.7 and 3.8
This is a bit weird. Did I overlook something stupid in the last release? If so, this should be quick to solve at least.
On ubuntu 20.04
kris@krislamb:~/projects/body-detection$ ./test.py --window pygame
Traceback (most recent call last):
File "./test.py", line 4, in <module>
import moderngl_window
File "/home/kris/projects/moderngl-window/moderngl_window/__init__.py", line 13, in <module>
import moderngl
File "/home/kris/projects/body-detection/moderngl.py", line 7, in <module>
class BasicWindowConfig(moderngl_window.WindowConfig):
AttributeError: partially initialized module 'moderngl_window' has no attribute 'WindowConfig' (most likely due to a circular import)
kris@krislamb:~/projects/body-detection$ python3 --version
Python 3.8.2
kris@krislamb:~/projects/body-detection$ pip3 list | grep pygame
pygame 2.0.0.dev6
kris@krislamb:~/projects/body-detection$ pip3 list | grep moderngl
moderngl 5.6.0
moderngl-window 2.1.1 /home/kris/projects/moderngl-window
and the test app I was using.
#!/usr/bin/python3
import math
import moderngl_window
class BasicWindowConfig(moderngl_window.WindowConfig):
"""Minimal WindowConfig example"""
gl_version = (3, 3)
title = "Basic Window Config"
def __init__(self, **kwargs):
super().__init__(**kwargs)
def render(self, time, frametime):
self.ctx.clear(
(math.sin(time) + 1.0) / 2,
(math.sin(time + 2) + 1.0) / 2,
(math.sin(time + 3) + 1.0) / 2,
)
if __name__ == '__main__':
moderngl_window.run_window_config(BasicWindowConfig)`
This is the problem: /home/kris/projects/body-detection/moderngl.py
It believes your local module is the moderngl library. Rename it to something else.
This can be spotted in the stack trace.
File "/home/kris/projects/moderngl-window/moderngl_window/__init__.py", line 13, in <module>
import moderngl
File "/home/kris/projects/body-detection/moderngl.py", line 7, in <module>
/facepalm My bad, I'm still learning the ropes on python lol
@lambage No worries. I'm just glad I could help solve the problem. Don't hesitate asking if you are stuck on some issue.
There are friendly communities like python discord : https://pythondiscord.com/
Also moderngl has a discord server linked in README.md
here.
Great places to ask for help.
Trying to run the simple examples I get this error
AttributeError: partially initialized module 'moderngl_window' has no attribute 'WindowConfig' (most likely due to a circular import)
I was able to get the cube_model.py working which appears to somehow get around this issue.
I assume it's because I'm using python3, is there an easy way to make this work?