2
$\begingroup$

So, I'm trying to get nifscripts to work with blender 2.49b on a Mac. I suspect there may be an issue with the installed versions of python, but for the life of me I can't suss it out.

So, when I start blender from the command line, I see:

Compiled with Python version 2.5.6.
Checking for installed Python... got it!

So far so good. Running a system report generates expected output:

Paths:

/Applications/blender.app/Contents/MacOS/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload
/Library/Python/2.5/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC
/Applications/blender.app/Contents/MacOS/.blender/scripts
/Applications/blender.app/Contents/MacOS/.blender/scripts/bpymodules

So, it seems to be using the same python it was built off of. However, when I try to run the nif_common.py script, I start getting syntax errors. The first one seemed to involve the with... as f keyword, which I resolved by using the more traditional f = syntax.

However, now I get the following:

Traceback (most recent call last):
  File "nif_common.py", line 91, in <module>
  File "/Applications/blender.app/Contents/MacOS/.blender/scripts/bpymodules/pyffi/formats/nif/__init__.py", line 3277
    return b''
             ^
SyntaxError: invalid syntax

I fail to see the invalid syntax; this scripts uses that form several times, and only the last does it throw an error.

Line 91 of nif_common.py reads:

from pyffi.formats.nif import NifFormat

And the __init__.py file contains at line 3277:

    def _get_string(self, offset):
        """A wrapper around string_palette.palette.get_string. Used by get_node_name
        etc. Returns the string at given offset."""
        if offset == -1:
            return b''

        if not self.string_palette:
            return b''</pre>

Now, my familiarity with python is minimal, so I'm not sure whether the offending '' does anything or not. But I can't see how invalid syntax would end up in established code like this...

$\endgroup$
1
  • $\begingroup$ I am lead admin for Niftools. It is best to drop by niftools.org/chat.html You are bound to run into more issues, we can help you better there. As these scripts are written 2.49b the expectation here is not to get support, @Ideasman42 tends to just be awesome anyways. $\endgroup$
    – neomonkeus
    Aug 8, 2014 at 17:04

2 Answers 2

4
$\begingroup$

b'' or b"" define a byte string, this is a feature of Python2.7 or 3.x

See: https://stackoverflow.com/questions/17707085/python-string-b-prefix-byte-literals

You can use Python2.7 with Blender2.4x, but you'll have to recompile Blender, linking to the newer Python version.

$\endgroup$
0
$\begingroup$

As ideasman has explained you need at least 2.6.x of python installed, due to the relatively newer python features uses compared to the version you have currently install, the recommended version being 2.6.7

The script have additional dependencies, pyffi which requires the use of the 32-bit install.

For recommended installation requirements see - http://niftools.sourceforge.net/wiki/Blender

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .