Run python script on terminal (ubuntu)?

0 votes

I've just changed my OS and I'm now using ubuntu and I can't run any script on my terminal.

I made sure to have the #!/usr/bin/env python but when I go to the terminal and type, for example python the terminal shows an error message like this

python: can't open file '': [Errno 2] No such file or directory

I must save the file in any specific folder to make it run on terminal?

Oct 31, 2018 in Python by findingbugs
• 3,140 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Your shell in the terminal has a concept of "Current working directory", which is what directory (folder) it is currently "in".

Thus, if you type something like:

python needs to be in the current working directory. In Linux, you can change the current working directory with cd.

answered Oct 31, 2018 by Priyaj
• 56,120 points

Related Questions In Python

0 votes
1 answer

How to run django unit-tests on production database in Python?

In case someone googles here searching for ...READ MORE

answered Nov 28, 2018 in Python by Nymeria
• 3,500 points
0 votes
1 answer

How can I run terminal commands in python?

You can use the subprocess or os module to do this. Using ...READ MORE

answered Feb 3 in Python by Omkar
• 65,850 points
0 votes
2 answers

What do you mean by python scripting? What is a script and a module in python?

A scripting language is a programming language ...READ MORE

answered Mar 14 in Python by rajesh kumar
0 votes
1 answer

Run Unix command within Python

From the python docs, use the subprocess ...READ MORE

answered Apr 27, 2018 in Python by Nietzsche's daemon
• 4,260 points
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,200 points
0 votes
1 answer

How to enable python3 in vim?

You didn't tell us the platform you're ...READ MORE

answered Jan 21 in Python by SDeb
• 9,540 points
0 votes
1 answer

Install Python on Ubuntu

@Abha you are right about pre-installation of python, ...READ MORE

answered Mar 1 in Python by Pratibha
• 2,520 points
0 votes
1 answer

Is there a way to run Python on Android?

YES! An example via Matt Cutts via SL4A -- "here’s ...READ MORE

answered Sep 19, 2018 in Python by Priyaj
• 56,120 points
0 votes
2 answers

How to run the Python program forever?

No, you can use while: pass I ...READ MORE

answered 2 days ago in Python by Lehan

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.