AttributeError: object 'module' does not have attribute 'printable'

I have this problem. Any ideas?

from OpenGL.raw.GLUT import *
      File "/usr/lib/python2.6/site-packages/OpenGL/raw/GLUT/__init__.py", line 6, in <module>
        from OpenGL.raw.GLUT.constants import *
      File "/usr/lib/python2.6/site-packages/OpenGL/raw/GLUT/constants.py", line 7, in <module>
        from OpenGL import platform, arrays
      File "/usr/lib/python2.6/site-packages/OpenGL/platform/__init__.py", line 36, in <module>
        _load()
      File "/usr/lib/python2.6/site-packages/OpenGL/platform/__init__.py", line 27, in _load
        plugin_class = plugin.load()
      File "/usr/lib/python2.6/site-packages/OpenGL/plugins.py", line 14, in load
        return importByName( self.import_path )
      File "/usr/lib/python2.6/site-packages/OpenGL/plugins.py", line 28, in importByName
        module = __import__( ".".join(moduleName), {}, {}, moduleName)
      File "/usr/lib/python2.6/site-packages/OpenGL/platform/glx.py", line 3, in <module>
        from OpenGL.platform import baseplatform, ctypesloader
      File "/usr/lib/python2.6/site-packages/OpenGL/platform/baseplatform.py", line 4, in <module>
        from OpenGL.platform import ctypesloader
      File "/usr/lib/python2.6/site-packages/OpenGL/platform/ctypesloader.py", line 6, in <module>
        import ctypes, logging, os
      File "/usr/lib/python2.6/logging/__init__.py", line 31, in <module>
        import sys, os, types, time, string, cStringIO, traceback
      File "string.py", line 3, in <module>
        chars=set(string.printable),
    AttributeError: 'module' object has no attribute 'printable'
+3
source share
2 answers

You have a file with a name string.pyin the current directory. This interferes with the standard library module with the same name. Rename the .py file and delete the created file string.pyc.

+4
source

I met the same problem. But in a different context.

I am setting up a Ubuntu virtual machine with VirtualBox. I am writing some python things in a folder shared between the VM and the Windows host. (Shared folder is a VirtualBox feature)

The reason for my death:

Windows . String.py, string.pyc , Windows. , "string.py" Python.

:

python .

0

Source: https://habr.com/ru/post/1732693/


All Articles