0

My Mac have python2.7 by default, and the scons3 have been installed successfully.However when compile the code, it still throws a SyntaxError: invalid syntax. i just go into the project folder and type scons -q

then it shows

scons: Reading SConscript files ...
  File "/Users/andromedae/physbam/PhysBAM_Tools/SConstruct", line 428

    print "%s has %d symbols exported"%(library_name,len(defs.keys()))

                                     ^

SyntaxError: invalid syntax

like it using python3? i have python3 installed by anaconda. but all i have done is:

python setup.py install 
cd \project
scons -q
  • Can you include the way you are executing this code? You are correct, it seems that it's executed using python3 – Giannis Mar 20 '18 at 11:53
  • Possibly related: https://stackoverflow.com/questions/48185262/how-to-execute-scons-in-a-python3-environment and https://stackoverflow.com/questions/44096321/compile-scons-in-python3 and https://stackoverflow.com/questions/32135869/managing-python-3-code-with-scons – dirkbaechle Mar 20 '18 at 13:00
  • @Giannis i just go into the project folder and type scons -q – eigenXspace Mar 20 '18 at 13:40
  • Did you try SCons 3.0.1, it should resolve this issue.. – bdbaddog Mar 20 '18 at 14:36
  • @bdbaddog my SCons is 3.0.1 :( – eigenXspace Mar 20 '18 at 15:38
  • Hmm.. are you sure you're not running with python 3.x? We had this issue in scons 3.0.0 and fixed it in 3.0.1 when running with python 2.7. Looks like you are running on windows? try running "python --version" – bdbaddog Mar 21 '18 at 16:29
  • Also stick this right before that line: import sys; print(sys.version) and see what output you get? – bdbaddog Mar 21 '18 at 16:31
  • Restating 2 above: Hmm.. are you sure you're not running with python 3.x? We had this issue in scons 3.0.0 and fixed it in 3.0.1 when running with python 2.7. try running "python --version" – bdbaddog Mar 21 '18 at 16:41
  • @bdbaddog sorry my scons is 3.0.0, and installed 3.0.1 it works thank u – eigenXspace Mar 22 '18 at 10:33
  • Please mark my answer below as the answer? – bdbaddog Mar 23 '18 at 12:27

1 Answers1

0

Install SCons 3.0.1. The issue described was introduced in SCons 3.0.0 but fixed in 3.0.1

bdbaddog
  • 3,357
  • 2
  • 22
  • 33