BodhiThis forum is for the discussion of Bodhi Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What did not work. Did you get an error? or the script did not execute? Are you sure that the script is any good? You have the correct modules installed?
Will the script run with python myscript.py
Are you executing a python2 script with python3? You left a few things out.
scriptname.py would work if the directory it is in was added to the PATH variable. The "./" only works if one is sitting in the directory where the script is as that is what "./" is saying to use - the current directory. Specifying the full path to that directory would also work.
e.g. If the file's full directory pathname is /mydir/mysubdir/scriptname.py the following would all work:
Code:
cd /mydir/mysubdir
./scriptname.py
-OR-
Code:
/mydir/mysubdir/scriptname.py
-OR-
Code:
PATH=$PATH:/mydir/mysubdir
scriptname.py
If it is a one off run then doing the first method would be the way to go. If it is something you intend to run all the time the easiest method is to modify the user profile (e.g. .profile, .bashrc, .bash_profile) to include the directory in the PATH being defined.
Thank you @MensaWater. It's not a frequently used app. I could even have been content to use "python scriptname.py" but I wanted to play around. LLL (long live linux).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.