Python - syntax error in established code 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 &lt;module&gt;
  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''&lt;/pre&gt;


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...
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.