I am completely new to Python and wanted to try this code from the tutorial:
istrue = 1
if istrue:
print ("be carefull!")
The code itself should be fine, but I can not find any way to execute this code inside the editor [Komodo-Edit](http://www.activestate.com/komodo-edit)
I am used to Visual Studio and QtCreator (experienced C++/Qt developer). I would expect a menu for debugging and a command such as 'start debugging' which should open a console or use a console inside the editor. I would in any case refuse to use a dos console because then the whole idea of using an IDE would be useless.
If other Python IDEs would be more useful (on windows, no costs) I could switch to another one (except for vim/emacs).
I used to use Komodo edit, but not anymore as It's more of a text editor than an IDE. I reccomend using Ninja-IDE or Eclipse with PyDev. But if you insist on using Konodo Edit, here's an option:
Go here: Toolbox > Add > New Command...
in the top field enter the name 'Run Python file' or something else. Then go to the 'command' field and enter this:
%(python) "%F"
Optionally, you could also specify key binding for fast python executing.
I tried Komodo Edit version 9 and 10. Matthias' method work for the version 9. Version 10, I couldn't see the option to choose the Interpreter.
Related
I am using Windows 10 and the text editor I am used to is Vim. I just intalled a shiny new GNU Octave copy (version 7.2.0). The Octave editor is pretty limited and I know it is possible to override it to vim/gvim. I have tried different things to make it work, without success.
Using the Preference->Editor pane
It seems that Octave is never able to understand what I put in there. I have tried using gvim, gvim.exe, a full path to my copy of gvim, etc. When I go to the editor, I either get:
or, when using a full path to the editor (ex. here: C:\Program Files (x86)\Vim\vim82\gvim.exe):
I think Octave is unable to deal with spaces in paths (at least from this edit box). It have also tried using single and double quotes, but it also fails:
Using an .octaverc file
When nothing worked in the GUI, I tried configuring an .octaverc file, as described in the GNU Octave Wiki:
edit mode sync
edit home .
EDITOR('gvim')
I tried with vim as well, full paths, etc, to no avail. Now I know that this file is read and executed when lauching Octave because when I put garbage in it, I see it in the Command Window. I also found a Set Path option in the GUI and I tried adding the path to gvim there, but it had no effect:
Question
I can I make my GNU Octave editor gvim, on Windows? I would like to use my current installation (default for Octave, default for Vim as well...)
Recently, I switched my OS to Ubuntu. I just started with collage and I have to learn pascal for my finals. But a problem occurred.
I installed Visual Studio Code and Pascal extension for it, but I am unable to run even a simple Hello World code. I wrote code, it saved automatically as .pas, but when I enter debug & run option in VSC it displays a message that says 'Open a file which can be debugged or run.', followed by 'debug' and 'run' buttons that I am unable to click and another message that says 'To further configure Debug and Run create a launch.json file.'
I am not even sure am I supposed to post questions such as this one on stackoverflow, but I sincerelly hope that someone could give me a hint on what to do. Solve this within Visual Studio Code or switch to another IDE (and which one would you recommend for Linux user) and pretend that nothing happened?
Thanks in advance.
I know this isn't an answer to "how to debug with pascal with vscode" but, perhaps you would find it easier to just use FPC / Lazarus (IDE) to do your work. While it doesn't have a dark theme, contrary to popular belief, that's not necessary to program.
The IDE is feature packed and allows for full code completion, debugging, etc... (everything you really need to do the work for school).
Additionally, you can use this open source tool to install everything you need for your platform in just a few button clicks (also allows for installing common library packages)
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases
download release for your OS
under "FPC Version" & "Lazarus Version" select trunkgit (or stable for an older version)
click the "Install/Update FPC + Lazarus" button
Have you Installed Pascal extension which is available for code to smoothly run pascal code.
If you haven't then try installing this extension using,
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
ext install alefragnani.pascal
You can always check,
https://marketplace.visualstudio.com/items?itemName=alefragnani.pascal
to install and configure pascal in vscode.
I will direct you to the debugging page from the Visual Studio Code documentation that details how to use the debugger and configure a launch.json file. VSCode is a generic IDE so you need to give it some information about your project before it knows how to run the debugger. This is what launch.json is for.
If I could make a suggestion. When you're learning how to program, it's best to start with the basics. Write a small program in a text editor (VSCode is fine, or Vim, or Nano, or Notepad, or whatever). Save the file. Compile and run the program on the command line.
Once you put an IDE in the mix, you have to learn how to use that as well. If you're stuck on both parts, it can be hard to make progress. That said, it's good to learn how to use the IDE, and you should spend some time reading the documentation and working through some of the examples. It takes some time, but it will pay you back a thousand times when you can work more quickly.
I am working with Python 3.4.
When I use IDLE and start typing, e.g.,
my_main_folder = "C:/Us"
in the editor window, and then press Ctrl + Space, IDLE offers me all subfolders of C:, and if I press Tab, the string is completed to "C:/Users".
That means that IDLE (or Python Shell) is able to recognize a string as a path.
How to make PyCharm (Community edition) do that?
Its not able in Community Edition Pycharm. But it can be done in Professional Edition Pycharm. I would suggest you to move to Professional Edition.
Does PyCharm have autocomplete file path?
BUT,There is a work around for it in Community Edition.
Place caret in such place and press Alt+Enter -- see if you will have "Inject language or reference" option in appeared menu. If it's present -- use it and choose "File Reference" there.
NOTE 1: this option may not be available if string is empty or has less than 2 characters in it
NOTE 2: this is temp injection -- AFAIK it will be lost after IDE restart (and you will need to do it again if needed)
Otherwise: select desired file in Project View panel and use "Copy Reference" -- it will copy a file path relative to the project root -- you may only need to add leading "/"...
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206574619-Autocompleting-relative-paths
After searching I found this answer:
can we tab through paths, in the same way you can in the terminal?
No, it's not posible:(
I wrote a plugin for Komodo called AutoCode that allowed me to ALT+Click on files in the Project view, and it would automatically resolve the right path
You can use 'Copy reference' in file right-click menu to copy file path relative to project root to clipboard. But this action doesn't unfortunately take resource roots into account
However, you can use CNTRL-SPACE twice and it will present a list of paths and files, example:
For a detailed description of this information see here
I'm using the Redhawk IDE. I noticed when I write Python in the IDE, none of the built-ins (len(),str(),True,False,etc...) are recognized, which gives errors and causes them to be underlined in red.
However, if I install to Target SDR anyway, the component seems to function normally.
How can I get Python in the IDE to recognize built-ins so I can get rid of the faulty errors?
Erik's answer led to the solution. What worked for me is:
Window -> Preferences
PyDev -> Interpreter - Python
Remove Python interpreter
Click "New..."
Enter interpreter name ("Python" works) and select path to interpreter
By default, the top option was selected. Make sure it isn't:
Click "OK"
Click "Apply"
You should now see that the built-in functions are recognized by Python.
If you can't run any Python in the IDE, there are two possible explanations:
1. You have an incorrect Python path being set for you by Eclipse, and you will have to adjust it manually. Using this article from Opal, you can easily check that Python is in fact correctly linking to your IDE, and if it isn't you can point it in the right direction.
2. You have a broken installation of Redhawk. Sounds dubious but you can always try a fresh install.
So I've been playing around with IDLE. Then the Lesson2 tells me to open the editor window, not the shell window. I'm not sure which is Editor? I have EDLE, Python Launcher (downloaded from python.org) and TextWranger...maybe I misunderstood about sth? :'(
IDLE combines several functionalities. It contains an interactive interpreter (the window where the >>> appears in, and in which you can bring code to execution immediately), and it's a small-scale IDE (integrated development environment), which means you can load, edit and save python-files, and launch them conveniently. This functionality is meant with "Editor". Probably just go to the Menu and pick something like "New File".