PyOpenGl在尝试遍历NoneTyp时导入失败

2024-09-30 01:34:49 发布

您现在位置:Python中文网/ 问答频道 /正文

试图让一个名为chemlab的lib在python3.5中工作

它需要PyQT4,而PyQT4需要PyOpenGL

所有这些都在64位计算机上,但从python到每个库的所有内容都是32位的(也许这很重要)

初始代码为

from chemlab.graphics.qt import QtViewer
from chemlab.graphics.renderers import PointRenderer
from chemlab.graphics.uis import TextUI

vertices = [[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [2.0, 0.0, 0.0]]
blue = (0, 255, 255, 255)

colors = [blue, ] * 3

v = QtViewer()

pr = v.add_renderer(PointRenderer, vertices, colors)
tu = v.add_ui(TextUI, 100, 100, 'Hello, world!')

v.run()

调用堆栈如下

Traceback (most recent call last):
  File "C:/Users/eldar/PycharmProjects/ChemTo3D/Proccessor.py", line 13, in <module> tu = v.add_ui(TextUI, 100, 100, 'Hello, world!')
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\qt\qtviewer.py", line 189, in add_ui
    ui = klass(self.widget, *args, **kwargs)
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\sitepackages\chemlab\graphics\uis.py", line 120, in __init__
    props = setup_textures()
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\uis.py", line 17, in setup_textures
    ft = ImageFont.truetype(font_name, height)
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\ImageFont.py", line 238, in truetype
    return FreeTypeFont(font, size, index, encoding)
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\ImageFont.py", line 127, in __init__
    self.font = core.getfont(font, size, index, encoding)
OSError: cannot open resource
Exception ignored in: <bound method VertexBuffer.__del__ of <chemlab.graphics.buffers.VertexBuffer object at 0x04FF7630>>
Traceback (most recent call last):
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\buffers.py", line 26, in __del__
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\wrapper.py", line 98, in __nonzero__
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 376, in __nonzero__
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 381, in load
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 887, in _find_spec
TypeError: 'NoneType' object is not iterable
Exception ignored in: <bound method VertexBuffer.__del__ of <chemlab.graphics.buffers.VertexBuffer object at 0x04FF7D10>>
Traceback (most recent call last):
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\buffers.py", line 26, in __del__
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\wrapper.py", line 98, in __nonzero__
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 376, in __nonzero__
  File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 381, in load
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 887, in _find_spec
TypeError: 'NoneType' object is not iterable

编辑:阻止任何内容显示的部分是文本。枕头一点也不舒服。如果不尝试显示文本,分子确实会显示,因此我不再确定opengl导入错误在做什么-可能什么都没有,可能着色器不可用。调查仍在进行中。你知道吗


Tags: inpylibpackageslocallinesiteusers

热门问题