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

• 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. – neomonkeus Aug 8 '14 at 17:04

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