Avatar of Doug Brennaman
Doug Brennaman
 asked on

how do I make a python program run from a bash shell?

on a raspberry pi I have a python script which runs without error from within Idle3 (sudo /usr/bin/idle3) When I try to run it from a shell script it fails with the error message "ImportError: No module named pytz".  It has no problem finding the other modules (picamera, time, and datetime)  I installed the pytz package using apt-get.
My searches have yielded suggestions relating to PATH, python installation etc. I cannot find documentation that has helped.
LinuxLinux DistributionsRaspberry Pi

Avatar of undefined
Last Comment
simon3270

8/22/2022 - Mon
simon3270

Are you running it as
    python script.py
or
   python3 script.py

(in case pytz is only installed in Python3)
ASKER CERTIFIED SOLUTION
Member_2_406981

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Doug Brennaman

ASKER
Andreas,
thank you.  That was the problem.  And thanks for providing the steps to correct it,
Doug Brennaman

ASKER
I've requested that this question be closed as follows:

Accepted answer: 0 points for Doug Brennaman's comment #a40460521

for the following reason:

The answer was educational.  I now know the reason for the error as well as the steps to solve it.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
simon3270

Doug, I think you may have selected the wrong answer. Whether or not you give any points to me, you should at least give some to Andreas!
Doug Brennaman

ASKER
Answer is informative, explained the problem and provided a fix.
Doug Brennaman

ASKER
simon,
thanks for pointing that out.  I did make a mistake in accepting my own comment as the answer.  I have accepted Andreas's answer.  
This is the first time I've posted a question so I was unfamiliar with the process.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
simon3270

No problem - we were all beginners once!

And welcome to EE.