w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Python Script not executing in Light Table shows error

I have no idea about the Light Table part, but the error you show is the one that you'd get if you were to somehow try to execute a Python 3 print function call under Python 2 (where print is a statement with a quirky syntax rather than a function). Lines 175-176 of site.py in the Python 3.4 distribution look like this (modulo leading indentation):

print("Error processing line {:d} of {}:
".format(n+1, fullname),
      file=sys.stderr)

and sure enough, if you try to execute that in a Python 2 interpreter you'll get a SyntaxError, with the cursor pointing to that same = sign:

Python 2.7.8 (default, Jul  3 2014, 06:13:58) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Error processing line {:d} of {}:
".format(n+1, fullname), file=sys.stderr)
  File "<stdin>", line 1
    print("Error processing line {:d} of {}:
".format(n+1, fullname), file=sys.stderr)
                                                                          
^
SyntaxError: invalid syntax

I'd suggest looking closely at the settings for the Light Table Python plugin to see if anything's awry. You should also check the setting for your PYTHONPATH environment variable. If it includes a reference to the C:Python34 directory and you're running Python 2, that could be the cause of the problem. Here's an example of the exact same problem on OS X, caused by starting Python 2 with a PYTHONPATH that refers to Python 3's library directory:

noether:~ mdickinson$ export
PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/
noether:~ mdickinson$ python2.7
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site.py",
line 176
    file=sys.stderr)
        ^
SyntaxError: invalid syntax




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.