Trouble adding Python to Path - python

I've followed the tutorial and I still can't get Python to run in the command prompt and hence can't get it to run in Sublime Text 3.
I seem to have the right address.
How can I fix this? Thank you.

Each directory should have its own entry. Instead, you have them all in one string. To create a new entry, press the new button and put in one directory.
It should look similar to this:

Related

Why doesn't highlighted text show what data type the highlighted text is?

I'm using pyton with VSC and ran into a problem while watching a tutorial; when highlighting a number in brackets, the data type doesn't show up, while it does in the tutorial. IE: when higlighting 4.5 in
print(4.5), it should say 4.5: float in a popup, but that doesn't happen. Can anybody help me?
Visual Studio Code does not have automatic intellisense, you need to download a language specific extention to use it.
Steps to download:
open the extentions menu located on the left toolbar (ctrl-shift-x).
search for python.
click install on the top result.
(optional) restart VSC, I don't know if it is necessary, but better safe then sorry.
I hope this fixes your problem :) .
Edit: I just checked, and after installing the extention will say something along the lines of 'reload to enable extention', if it does not, it doesn't need it. Otherwise, just click the text that says that.

The IDLE editor in Python will not run my code when I do not save it

I have written code in a New file window in IDLE.
When I run the code there is no output.
Instead a dialog box appears showing a window accessing Python Folder 37-32.
When i closed the dialog box and the file I tried to create a new simple code below but I when I ran the code I got the same Dialog box.
What is wrong?
sum = 2+3 print(sum)
I have attached a screenshot showing the code and the dialog box that appears when the Module is run
Before you can execute your code, your first need to save the file. Thats the dialog box that popped up.
You should have seen a popup box like below. Did you? Is is unclear?
Save Before Run or Check
? Source Must Be Saved
OK to Save?
[OK] [Cancel]
One reason to require saving is that exception tracebacks refer to the file and line of lines that lead to the exception.
If you had saved, sum = 2+3 print(sum) would be a SyntaxError.
You can run single statements in Shell without saving.
The RESTART lines says that the shell re-initialized the environment for executing your code.
You should normally not save your code buried in the installation Scripts directory. Better to make a directory in your user directory, for instance, C:/Users/yourname/py/.
Yes, one should usually open a new question for unrelated questions. But without access to your machine, it is hard to know what happened with 'new'. It may be that IDLE could create a file under .../appdate/.../Scripts/, but your code cannot. If the open call did not raise and exception, it was likely created somewhere. Until you are more experienced, better to use absolute paths, such as C:/Users/yourname/py/new.txt.

Make a full terminal window application like Vim/Mutt/Cmus

I'm not sure quite how to word this, which is probably why I'm having trouble finding an answer.
I have a command line script that runs a rummy game, I want it to take over the terminal kind of like how Vim or Mutt does, so that each round is refreshed in the full terminal window rather than just printing out row after row of text.
Can someone tell me what that is called, so I can research it and find out how to do it?
Repo: https://github.com/sarcoma/Cards
You're looking for a console user interface. One of the best libraries for python would be http://urwid.org/
As mentioned in a comment "pythons curses module does what you require".
This is what you need to take over the terminal: https://docs.python.org/3.9/howto/curses.html

How can I run a python script from within Kodi?

If I want to make a button in Kodi's menu and run a local python script upon clicking it, what's the best way to go about it?
file_path = xbmc.translatePath(os.path.join('insert path here to file you want to run'))
xbmc.executebuiltin("XBMC.RunScript("+file_path+")")
Very late reply but saw no one else had answered so though i'd put in just in case

How to copy text from IDLE?

Is there a way to copy text out of Python IDLE on a Mac? When I highlight text and copy then past into a text editor, I get the same text pasted. It is some of the first text I start with in IDLE. None of the other text will copy out.
From The Things I Hate About IDLE That I Wish Someone Would Fix (from 2011):
1.2) NEW FEATURE: Auto-Copy-On-Highlight
Once we get rid of being able to move the cursor off the last line, that opens a new opportunity to implement an automatic copy-on-highlight feature that many terminal and IRC client programs implement. Since this text is read-only, the only reason a person has for highlighting it is to copy it (they can’t delete it.) As soon as the user highlights text in the shell window, it is copied to the clipboard.
Looks like the best you can do is save as a .py file. Open that in a text editor and continue working in IDLE. With each save, the text editor will refresh with all updates, including errors. At least TextWrangler will.
Sometimes in things like a linux terminal you can't do a normal copy and paste, try holding Command/Control + Shift + C after highlighting things and seeing if that works, since you're on mac i'm not sure if it would be the Command or Control key so try both
EDIT: There is an apple discussion about the exact same thing. They discuss going into the options menu, then into configuration and navigating to the keys section. Then you use a built in key-set, their suggestion is using IDLE Classic Mac.
I cannot tell from your description exactly what you did and what happened. But I can recommend that you upgrade to 3.4.4 or 3.5.1 (or 2.7.11 for 2.7 users). Among other improvements, they all contain a patch to make right-click for context menu work on Mac Aqua. This was issue 24801 on the CPython bug tracker.
If there is still an actual problem on Mac, I would like to know so it can be fixed.

Categories