Python problem in sublime text

Asked

Viewed 2,421 times

1

Well, guys, I’m having a problem when I put my python code in sublime text to run.

The problem is, the code doesn’t work, just compile and nothing else.

In case, it is not running any line (trying to run via CTRL+B version 3.0).

I’m new to this publisher, so excuse me for any ignorance.

a = float(input("Digite um número: "))
b = float(input("Digite outro número: "))
print(a)

It only shows one this message:

[Finished in 0.0s]
  • Well, I was able to execute, but there’s a catch. When I run, I type the first value, it doesn’t go to the next line, for example. " Type a number: 5(enter)", then it does not go to the second/third part, which is to receive the other value and print the first value on the screen.

  • Solved the problem with the answer?

  • @kappa, decided by following these steps or performed some different step ? if yes, please describe it to us

2 answers

3


One solution to the problem is to create an execution system (Build System) alternative, to do this follow the following steps:

1. In a new Sublime tab paste the following code:

{
    "cmd": ["start", "cmd", "/k", "C:/Python27/Python.exe", "$file"],
    "selector": "source.python",
    "shell": true,
    "working_dir": "$file_dir"
}

2. Where is "C:/Python27/Python.exe" replace with the directory where the Python executable is on your computer with the bars / and not \as is standard of Windows.

3. Save the file with the name Python_cmd.sublime-build in the folder where the sublime is installed inside: Data\Packages\User.

4. In Sublime click on Tools > Build System and select Python_cmd, when using the shortcut Ctrl + B open the CMD window to execute the Python commands.

  • It didn’t work for me.

  • @Kappa, Which operating system are you using? Which version of Sublime Text? Is it installed or Portable? Did you follow all the steps? Which Python directory? Which Sublime directory? Tell me to help you.

  • Friend, I managed to solve, thank you!

  • @Kappa, how nice! :)

0

Good morning

  1. To solve this problem, with an open sublime tab press Ctrl + shift + p

    Will open a tab, type in it Package Control and look for the option of install.

    Now in the same tab install the Sublimerepl

    Close the sublime.

  2. Now go on Tools->Sublimerepl->Python->Python Run Corrent File

    To have a command similar to Ctrl + b to compile go to:

    preferences-> key bindings and paste the following line:

[

{ "keys": ["ctrl+alt+b"], "command": "run_existing_window_command", "args":
{
    "id": "repl_python_run",
    "file": "config/Python/Main.sublime-menu"
}}

]

Being the command Ctrl+alt+b now used to compile. I hope I’ve helped!

This video shows the procedure

https://www.youtube.com/watch?v=R5-niid0m8A

Browser other questions tagged

You are not signed in. Login or sign up in order to post.