I am a new user of Sublime text.
It has been working fine for a few days until it began to refuse to compile anything and I don't know where the problem is. I wrote python programs and pressed cmd+b and nothing happened. When I try to launch repl for this file - that also doesn't work. I haven't installed any plugins and before this issue all has been working well.
Any suggestions on how to identify/fix the problem are greatly appreciated
Yes, you might want to give more detail. Have you made sure you have saved the file as .py? Try something simple like Print "Hello" and then see if this works.
Related
I recently started using Python on VScode and I have been having problems with my output.The code runs smoothly(no problems detected) but the result doesnt appear in my output.The problem isnt with my code because even a simple command like print("Hello world") doesnt appear.
Can someone help me?
Here are some screenshots
Also I tried running the program from another terminal but I had to save the file,for exapmple dna.py, and the system wont let me.An error message appears saying it this file is not supported by .ipynb support and the name should match this pattern .ipynd(tried it,still wont accept it)
The code that I created
The image in my ouput after I run the code
I suggest reviewing the official Visual Studio Code Python documentation and tutorial.
Also, try to run the file directly in a terminal and see if it solves your problem.
ex: python my_script.py
See this answer for more details.
I'm a noob in computer programming, today i installed vscode to learn python, everything was right, i run short and simple lines of code installed some extensions, but i dont know what happened, I'm not sure if i changed some configuration but when i try to run little lines of code (with the button) instead of running it and showing it to me in the "terminal section", it sends me to the "output" section and it just says that the code already run and its done.
Do somebody knows how to solve it please, it really makes me sad that i just ruined this program because its my first day and this already screw it.
As you can see in the picture, i run the code and it shows off something different in the output section, i wrote that but later changed it. It seem like it runs the file but only when i save it. :(
You must save the file to get the new output everytime.
For running code in Terminal with the button -
It looks like you are using Code Runner vscode extension. Which by default uses Output section to show output and cannot take input. You can change this behavior of that extension by pressing ctrl + , and going into vscode settings. Then just search code runner run in terminal You'll see an option to enable Run in Terminal feature turn that on.
So I just created a simple script with selenium that automates the login for my University's portal. The first reaction I got from a friend was: ah nice, you can put that on my pc as well. That would be rather hard as he'd have to install python and run it through an IDE or through his terminal or something like that and the user friendliness wouldn't be optimal.
Is there a way that I could like wrap it in a nicer user interface, maybe create an app or something so that I could just share that program? All they'd have to do is then fill in their login details once and the program then logs them in every time they want. I have no clue what the possibilities for that are, therefore I'm asking this question.
And more in general, how do I get to use my python code outside of my IDE? Thusfar, I've created some small projects and ran them in PyCharm and that's it. Once again, I have no clue what the possibilities are so I also don't really know what I'm asking. If anyone gets what I mean by using my code further than only in my IDE, I'd love to hear your suggestions!
The IDE running you program is the same as you running your program in the console. But if you dont want them to have python installed (and they have windows) you can maybe convert them to exe with py2exe. But if they have linux, they probably have python installed and can run you program with "python script.py". But tell your friends to install python, if they program or not, it will always come in handy
I edited oldscript.py and then saved it in the same directory as newscript.py. After this, when I do %run newscript.py in ipython it seems to run oldscript.py before running newscript.py. I know this because it gives an output from oldscript.py before giving the outputs for newscript.py. It looks something like this:
%run newscript.py
output from oldscript.py
outputs from newscript.py
Why is it doing this? I've deleted the .pyc files, but that didn't help. I restarted ipython, my terminal, and my computer and nothing has changed. As far as I know, I don't have anything pointing to oldsript.py in newscript.py. I'm in the correct directory. I also tried running it in spyder and the terminal. Both give the same outputs. I feel like I've tried everything.
Also, I should mention that I'm new to python so there may be an obvious solution I haven't tried. Please advise :)
I'm pretty sure I just figured it out. I removed oldscript.py from the directory and it worked! Who knew Python could be so particular?! Okay, probably a lot of you, but give me a break I'm a noob ;)
So I'm trying to setup the terminal in conjunction with Notepad++ and I'm a little confused. I've managed to download Python 2.7 and load it up in Powershell but I don't really know where to go from there. Do I even need to use a terminal? I know it says you can't use IDLE but it would be a lot easier. If anyone can guide me through getting the right setup to go on with the book I'd appreciate it a lot.
If you managed to get python running in the powershell following the Exercice 0, and you read the "Warning For Beginners" section, you can proceed to Exercice 1.
Why do they recommend that setup? Notepad++ is on Windows a powerful text editor very similar to other text editors, so you will soon get familiar with it. You will need to save your scripts in files and type a special line in the powershell to run and test them. That way you will get accustomed to running programs with arguments and if you make a failure, you can edit your code, save it and run it again.
In IDLE, you are already in a Python environment, so you cannot give arguments to your program inside it (actually you can but it's complex). You can also get an editor, save your file and run the script but also here it's a harder and less obvious way than Notepad++. When you get comfortable with the environment in that book you may change to get something that suits better your way of doing.