Import error messages now explain that NBT acceleration is not available, and gives tips on how to enable it by getting pyximport working.
This commit is contained in:
parent
167f7e960c
commit
751f190274
25
nbt.py
25
nbt.py
@ -3,14 +3,33 @@ try:
|
|||||||
try:
|
try:
|
||||||
import _nbt
|
import _nbt
|
||||||
from _nbt import *
|
from _nbt import *
|
||||||
|
print "Accelerated NBT module loaded."
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print "Import error loading precompiled _nbt extension. Trying pyximport..."
|
print "Import error loading precompiled _nbt extension. Trying pyximport..."
|
||||||
import numpy
|
import numpy
|
||||||
from pyximport import install; install(setup_args={'include_dirs':[numpy.get_include()]})
|
from pyximport import install; install(setup_args={'include_dirs':[numpy.get_include()]})
|
||||||
import _nbt
|
import _nbt
|
||||||
from _nbt import *
|
from _nbt import *
|
||||||
|
print "Accelerated NBT module loaded via pyximport."
|
||||||
except ImportError, e:
|
except ImportError, e:
|
||||||
print "Import error loading _nbt extension", repr(e)
|
print "Exception: ", repr(e)
|
||||||
import traceback; traceback.print_exc()
|
print """Import error loading _nbt extension. NBT acceleration will not be available.
|
||||||
from pynbt import *
|
|
||||||
|
|
||||||
|
To take advantage of the accelerated NBT module, install both Cython and your system development tools. Use this
|
||||||
|
command to install Cython:
|
||||||
|
|
||||||
|
easy_install cython
|
||||||
|
"""
|
||||||
|
import sys
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
print """You must also install the Xcode development tools, available from the Apple Developer Connection at connect.apple.com"""
|
||||||
|
elif sys.platform == "win32":
|
||||||
|
print """You must also install either Visual Studio 2010 or the Windows Platform SDK 7.0 from MSDN somewhere on microsoft.com"""
|
||||||
|
else:
|
||||||
|
print """You must also install your system's development tools. On Debian and Ubuntu, this command should work:
|
||||||
|
|
||||||
|
sudo apt-get install gcc
|
||||||
|
"""
|
||||||
|
print
|
||||||
|
from pynbt import *
|
||||||
|
print "Pure-python NBT module loaded."
|
||||||
|
Reference in New Issue
Block a user