Skip to content Skip to sidebar Skip to footer

Python 3 Is Not Working With Sublime Text 2

I have been using Sublime Text 2 for over a year and recently started using it for Python. Sublime has a built it build for Python which I tried using (the built in one is for 2.7.

Solution 1:

Your problem is that the sublimetext builds cannot take user input - there is no input stream connected. Your Python version is irrelevant.

However, it's possible to write a plugin to take input!


As for the config files, just use the "preferences -> browse packages" menu item.

Solution 2:

I found that the OP solution of editing the 'Python.sublime-build' file from 'python' to 'python3' functions.

I know this because the OP's solution helped me when I had the same problem, and the proof is in the following line:

import sys
print(sys.platform)

The entire practice code:

import sys
print(sys.platform)
print(2 ** 100)
x = 'Spam!'print(x * 8)
input('Press ENTER to exit...')

With Python 2.7 the return is 'linux2' (for me). With Python 3.3 the return is 'linux'. This was first detected by me using PVM. When I did 'Build' in Sublime 2, 'linux2' was the output; using the OP's method changed the output to 'linux', so I think that is the correct thing to do (easiest anyway).

Build output with Python:

linux2
1267650600228229401496703205376
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!
Press ENTER toexit...Traceback (most recent call last):
  File "/home/sick/Python/script1.py", line 6, in <module>
    input('Press ENTER to exit...')EOFError: EOF when reading a line
[Finished in0.0s withexit code 1]

Build output with Python3:

linux
1267650600228229401496703205376
Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam!
Press ENTER toexit...Traceback (most recent call last):
  File "/home/sick/Python/script1.py", line 6, in <module>
    input('Press ENTER to exit...')EOFError: EOF when reading a line
[Finished in0.1s withexit code 1]

There is no program error; it gives an error because the program is expecting user input (as far as I know, but I'm only on chapter 4).

Solution 3:

I've had just the same problem and I could do that only when I started this program using the terminal:

cd WayToFile
 python FileName

Everything is done. Perhaps it's how it must be working in all Python versions

Post a Comment for "Python 3 Is Not Working With Sublime Text 2"