6

I am trying Light Table and learning how to use it. Overall, I like it, but I noticed that the only means of making the watches and inline evaluation work in Python programs uses Python 2.7.8, making it incompatible with some of my code. Is there a way to make it use Python 3 instead?

I looked on Google and GitHub and I couldn't find anything promising.

I am using a Mac with OS X 10.10.2. I have an installation of Python 3.4.0 that runs fine from the Terminal.

Elias Zamaria
  • 96,623
  • 33
  • 114
  • 148

4 Answers4

3

I had the same problem with using a syntax that was only valid on Python3.3. - Go to Settings:User Behaviour - add the line (find the real path of your python binary): [:app :lt.plugins.python/python-exe "/usr/bin/python3.4"] - Save and test in your lighttable

It worked for me :) Hope it helps

carocad
  • 455
  • 6
  • 12
  • It worked. Thank you. Here is the line I added, for everyone's reference: `[:app :lt.plugins.python/python-exe "/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4"]` – Elias Zamaria Apr 13 '15 at 21:43
0

Hit Ctrl + Space to bring up the control pane. Then start typing Set Syntax and select Set Syntax to Python. Start typing your Python then press Ctrl + Shift + Enter to build and run the program.

Malik Brahimi
  • 16,341
  • 7
  • 39
  • 70
  • I hit `Ctrl + Space`. I typed `Python` in the search box in the sidebar that showed on the right side and there were no results. – Elias Zamaria Feb 04 '15 at 17:49
  • Then start typing `Set Syntax` – Malik Brahimi Feb 04 '15 at 19:58
  • 1
    I hit `Ctrl + Space` and typed `Set Syntax`. The one match that came up said "Editor: Set current editor syntax". I clicked on that and it gave me a bunch of choices. The only one that looked relevant was "Python". I picked that and nothing seemed to happen. I typed `import sys; sys.version` into the editor and tried evaluating the `sys.version`. It came back as `2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]`, just like it did before. – Elias Zamaria Feb 04 '15 at 20:05
  • So that means you haven't added Python 3 to your system path. – Malik Brahimi Feb 04 '15 at 20:12
  • What do you mean by that? If I type `echo $PATH` in the Terminal, I see a bunch of directories including `/Library/Frameworks/Python.framework/Versions/3.4/bin`. Do I need to do anything else? – Elias Zamaria Feb 04 '15 at 20:30
  • Perhaps, Light Table doesn't support Python 3. – Malik Brahimi Feb 04 '15 at 21:11
0

I got the same problem. It worked for me after saving the file with a .py extension and then typing Cmd+Enter.

Anas
  • 1
  • I typed `import sys; sys.version`, saved it in a file with a .py extension, selected the `sys.version`, pressed `Cmd + Enter`, and it showed `2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]`. – Elias Zamaria Feb 04 '15 at 21:24
  • It worked only because it use the 2.7 python. Cannot use Python 3 without solving the Unicode issue see my answer – Eduard Florinescu Apr 11 '18 at 10:46
0

Besides changing Ctrl+Space Settings:User Behaviour

 [:app :lt.plugins.python/python-exe "/path_to_your_custom_bin/bin/python3.4"]

There is an issue with Unicode ( 'unicode' is not defined), and I also needed to modify ltmain.py to work with Python3 see here:

https://github.com/eduardflorinescu/lighttable_python3_patch/blob/master/ltmain.py

Make sure you backup the orginal ltmain.py, you can diff the two to see what are the differences and what was changed:

Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179