[mythtv-users] Can't Compile Frontend due to SyntaxError: invalid syntax

Jim Stichnoth stichnot at gmail.com
Sun Oct 24 03:13:43 UTC 2010


On Sat, Oct 23, 2010 at 1:40 PM, Greg Grotsky <spikeygg at gmail.com> wrote:
> I'm updating all my systems that run myth, no problems with the first two.
>  The last one for some reason is choking on mythtv compile, complaining
> about python stuff.  I don't know what to do to make it work.  This is what
> I'm getting:
> $ make
> sh version.sh /usr/src/mythtv
> make -C external/FFmpeg
> make[1]: Entering directory `/usr/src/mythtv/external/FFmpeg'
> make[1]: Nothing to be done for `all'.
> make[1]: Leaving directory `/usr/src/mythtv/external/FFmpeg'
> make -C bindings/perl
> make[1]: Entering directory `/usr/src/mythtv/bindings/perl'
> make[2]: Entering directory `/usr/src/mythtv/bindings/perl'
> make[2]: Leaving directory `/usr/src/mythtv/bindings/perl'
> make[1]: Leaving directory `/usr/src/mythtv/bindings/perl'
> make -C bindings/python
> make[1]: Entering directory `/usr/src/mythtv/bindings/python'
> python setup.py build
> running build
> running build_py
> running build_scripts
> python setprefix.py "/usr/local"
> setprefix.py:18: Warning: 'with' will become a reserved keyword in Python
> 2.6
>   File "setprefix.py", line 18
>     with open(path) as fi:
>             ^
> SyntaxError: invalid syntax
> make[1]: *** [python_build] Error 1
> make[1]: Leaving directory `/usr/src/mythtv/bindings/python'
> make: *** [bindings/python] Error 2
> $
> At first I thought my checkout was bad so I checked out a clean version from
> the trunk but no love.
> -Greg

If you can't update your python installation (presumably to 2.6 or
later), you can apply this patch.  I don't know python and I'm sure
the patched version is not equivalent to the original, but at least it
lets me complete the build.

Jim

Index: bindings/python/setprefix.py
===================================================================
--- bindings/python/setprefix.py        (revision 26972)
+++ bindings/python/setprefix.py        (working copy)
@@ -15,11 +15,11 @@
     raise Exception("Cannot find temporary build file for 'static.py'.")

 path = os.path.join(path,'static.py')
-with open(path) as fi:
-    for line in fi:
-        if 'INSTALL_PREFIX' in line:
-            line = "INSTALL_PREFIX = '%s'\n" % prefix
-        buff.append(line)
+fi = open(path)
+for line in fi:
+    if 'INSTALL_PREFIX' in line:
+        line = "INSTALL_PREFIX = '%s'\n" % prefix
+    buff.append(line)

-with open(path,'w') as fo:
-    fo.write(''.join(buff))
+fo = open(path,'w')
+fo.write(''.join(buff))


More information about the mythtv-users mailing list