“sudo python anyfile.py” not working in LXTerminal

General Tech Learning Aids/Tools 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

I have created a .py file that turns on a LED, as in the tutorials on raspberrypi.org.

It is my understanding that I should be able to open the LXTerminal in Raspbian, type the following command and have the .py file execute properly.

sudo python led_on.py

The .py script executes fine in the python terminal so the script is good.

It is my understanding that when I type sudo python led_on.py in the LXTerminal it should also work.

Are my statements correct? Should this command in the LXTerminal work?

sudo python led_on.py

I have edited to provide more information:

pi@raspberrypi:~ $ ls -al
total 120
drwxr-xr-x 19 pi   pi   4096 Apr 18 00:18 .
drwxr-xr-x  3 root root 4096 Apr 15 08:13 ..
-rw-r--r--  1 pi   pi     69 Apr 15 08:55 .asoundrc
-rw-------  1 pi   pi   1899 Apr 18 07:25 .bash_history
-rw-r--r--  1 pi   pi    220 Mar 18 01:09 .bash_logout
-rw-r--r--  1 pi   pi   3512 Mar 18 01:09 .bashrc
drwxr-xr-x 11 pi   pi   4096 Apr 15 08:26 .cache
drwxr-xr-x 15 pi   pi   4096 Apr 15 09:58 .config
drwx------  3 pi   pi   4096 Mar 18 01:58 .dbus
drwxr-xr-x  2 pi   pi   4096 Apr 17 19:50 Desktop
drwxr-xr-x  5 pi   pi   4096 Apr 15 08:13 Documents
drwxr-xr-x  2 pi   pi   4096 Apr 15 22:51 Downloads
-rw-r--r--  1 pi   pi      6 Apr 17 22:52 findme
drwxr-xr-x  2 pi   pi   4096 Mar 18 01:58 .gstreamer-0.10
-rw-r--r
                                                
                                                
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.