run terminal commands in spyder ipython console - python

i have a python script and when I run it in ubuntu terminal it makes my robot to go forward in gazebo simulator. I also have some codes which I have written in spyder. I want to run that gazebo commands from my spyder ipython console, but when I'm writing the codes that I ran successfully in standard terminal, spyder gives me invalid syntax error. actually I want to know how I can run a gazebo python code in my spyder console.
file:///home/niloofar/Desktop/Screenshot%20from%202019-11-03%2021-07-43.png
This is the picture of terminal which I can run my code in :
file:///home/niloofar/Desktop/Screenshot%20from%202019-11-03%2021-06-31.png

Related

Unable to set up vscode to practice python

Today just for practice I have downloaded and installed vscode.
I saw a tutorial on the installation of vscode for python and followed the procedure exactly.
But upon completion, whenever any python code is running, it is throwing an exception.
Eg:- A simple code I was trying to run like
def greet():
print 'Hello world'
But the terminal is throwing an exception saying "Invalid Syntax"
I really don't know where I am going wrong
If anyone of you has experience working on vscode and is willing to help then please tell me what I can do
The extensions I have enabled:-
Code Runner,
Python
Earlier the python extension was not enabled, but even after enabling it, the error is still there
Please have a look at the problem I am facing in setting things up with vscode
You should not type in python in the terminal.
Because the Python Extension only sends some commands to the terminal and then executes them.
If you type python in the terminal you will enter into the interactive mode, and the commands which intended to be executed in the terminal will be executed in the python interactive mode, and lead to SyntaxError.
So, you can get out of the python interactive mode through Ctrl+Z shortcut or kill the terminal and then execute the commands in a new terminal.

VSCode Remote SSH: Run Python File in New Terminal

I am using the Remote SSH extension for VSCode. Whenever I try to run a Python file in the Python terminal using the Run Python File in Terminal command, while the terminal is already executing another python program, VSCode tries to execute the new program in the same Python terminal, instead of opening a new terminal. Is there a way to execute each python program in a new terminal so that multiple programs can run simultaneously?
Edit: Tried to open a new Python terminal explicitly, but still, the Run Python File in Terminal is always routed to the first terminal. If I run the Python program explicitly in the new terminal by typing python my_prog.py it works, but I am looking for an interactive way.
In VS Code, the command "Run Python File in Terminal" is executed by default in a "default" "Terminal", which avoids the impact of runtime confusion and reduces the time to find python and file paths at runtime.
If synchronization is required, VS Code currently does not support running two or more terminals simultaneously. You can refer to this link:
Can VSCode automatically run python scripts in two or more terminals at the same time?
If you don’t require synchronization, only need to be in a new independent terminal every time the code is executed, you can set it in "launch.json": "console": "externalTerminal",
Then click Ctrl+F5 to run the code or click F5 to debug the code:

Terminal is running on python on ubuntu 20.04

my terminal is running on python 3.8 and I don't have the terminal when I open the terminal it opens like below:
here is the image of terminal right after i open it
what should I do to get rid of this problem and go to normal terminal?
however I think it is because a package I installed on atom named build-python please help me.I think it is a child process but I couldn't kill it
edit : i forgot to say that when I press Ctrl+D in order to exit the python on terminal I get following screen:
here is the image

what can I do if a program can be run by python console while can not be run by ipython console?

It seems that the spyder has removed python console, but I got a program can only be run by python console, what can I do? or is there any thing I am wrong?
I got some codes from github, and it needs ADB driver for Android, after I installed ADB, I can run the program in cmd using python wechat_jump_auto.py, but cannot run in spyder with ipython.
In Spyder3 installed in Windows OS, we can add the path to adb using Tools --> Current user environment variables....
Here, we can add the path to adb.exe file by appending it to the path variable. Then, we need to restart Spyder3. Then you will be able to directly run your script with access to adb.exe from Spyder3 IPython console or simply by clicking Run button.
Just came across the same problem as you recently.
In fact, it seems that program using ADB tools just cannot run in Spyder even by python console (my Spyder IDE is equipped with both Ipython console and Python console).
One practical way to solve this problem is to run your code in cmd.
Open your cmd window and do something like this:
python "xxx(path)\xxxx.py(file name)"
In my case, it looks like this:
example image
Hit Enter, and hopefully your code will run successfully.
If it still cannot run, maybe you haven't set your environment variables correctly.
Hope this can solve your problem. Good luck :)

How can I enable Run terminal Output on PyCharm 2017.1

Since I upgraded PyCharm from 2016.3.3 to the latest 2017.1 the Run terminal Output is not displaying as my scrip runs from beginning to end. Instead the output on the terminal is shown at the very end once the test script completes running.
Can I adjust the Run Terminal to display text/output as the script is running instead of having it all displayed at the end in the latest version of PyCharm?
Known issue in Pycharm, see link to view the bug: https://youtrack.jetbrains.com/issue/PY-22505

Categories

Resources