3

I have installed scons 2.3.2 and have python 2.4.

When I run scons, I am seeing the following error:

scons
Import failed. Unable to find SCons files in:
  /usr/bin/../engine
  /usr/bin/scons-local-2.3.2
  /usr/bin/scons-local
  /usr/lib/scons-2.3.2
  /usr/lib/scons-2.3.2
  /usr/local/lib/scons-2.3.2
  /usr/lib/python2.4/site-packages/scons-2.3.2
  /usr/lib/python2.4/site-packages/scons-2.3.2
  /usr/local/lib/python2.4/site-packages/scons-2.3.2
  /usr/lib64/scons-2.3.2
  /usr/lib/scons
  /usr/lib/scons
  /usr/local/lib/scons
  /usr/lib/python2.4/site-packages/scons
  /usr/lib/python2.4/site-packages/scons
  /usr/local/lib/python2.4/site-packages/scons
  /usr/lib64/scons
Traceback (most recent call last):
  File "/usr/bin/scons", line 190, in ?
    import SCons.Script
  File "/usr/lib/scons/SCons/Script/__init__.py", line 76, in ?
    import SCons.Environment
  File "/usr/lib/scons/SCons/Environment.py", line 48, in ?
    import SCons.Defaults
  File "/usr/lib/scons/SCons/Defaults.py", line 52, in ?
    import SCons.Tool
  File "/usr/lib/scons/SCons/Tool/__init__.py", line 50, in ?
    import SCons.Scanner.C
  File "/usr/lib/scons/SCons/Scanner/C.py", line 36, in ?
    import SCons.cpp
  File "/usr/lib/scons/SCons/cpp.py", line 398
    p = self.stack[-1] if self.stack else self.default_table
                        ^
SyntaxError: invalid syntax

I did a find and found that SCons is present in /usr/lib/scons. I am not sure why scons is not able to pick it up.

What am I missing?

Nikhil
  • 2,168
  • 6
  • 33
  • 51

1 Answers1

6

The problem (from the bottom of the traceback) is a Syntax error:

    p = self.stack[-1] if self.stack else self.default_table
                        ^
SyntaxError: invalid syntax

This is because you are running a version of Python that doesn't support conditional expressions:

Support for this syntax was added in 2.5, see the docs

SiHa
  • 7,830
  • 13
  • 34
  • 43
  • Thanks! The scons website mentioned python 2.4 is sufficient – Nikhil Jul 17 '14 at 06:53
  • Hmm. That may be because in [PEP 308](http://legacy.python.org/dev/peps/pep-0308/) it is stated in an early draft that this would be implemented in 2.4. – SiHa Jul 17 '14 at 07:23
  • 1
    Please note that the SCons 2.3.2 (once it's running properly) should also warn you that all pre-2.7 versions of Python are deprecated. Python 2.7 is the floor version for development now, because we're moving towards a combined Python2+3 source code base. – dirkbaechle Jul 17 '14 at 07:56