Script running from terminal after setting pythonpath and running “thonny&” command, but not when thonny ide is opened directly
Asked today
Modified today
Viewed 3 times
0
I am using a Raspberry Pi OS 64-bit to run a script that will capture an image. I have gone through installing the right packages for libcamera for this OS and can run libcamera apps using my terminal. I get the error: no module named picamera2 whenever I try to run the script in thonny ide.
However, I have set my pythonpath variable to
/home/pi/picamera2:/home/pi/libcamera/build/src/py:/home/pi/kmsxx/build/py:/home/pi/python-v4l2
and when I run the command “thonny&” or “thonny” from my terminal, my script runs without an error
Please, how can I be able to run my scripts without having to go through this process?
raspbianscriptraspberry-pi-os-bullseyeidelibcamera
EditFollowCloseFlag

53k2525 gold badges8888 silver badges178178 bronze badges
asked 1 hour ago
111 bronze badge
New contributor
1 Answer
Sorted by:
Reset to default Highest score (default) Date modified (newest first) Date created (oldest first)
0
thonny
is an integrated development environment for Python that is designed for beginners. If you just want to run a python program forget thonny
and just run with python!
All my python scripts start with:-
#! /usr/bin/env python3
so they can be run from terminal.
Alternately just run python3 scriptname
EditFollowFlag
answered 47 mins ago

53k2525 gold badges8888 silver badges178178 bronze badges
- hi, milliways. thank you, I’ll do that. I wanted to know if there was a way it could be run from thonny itself, cause i’m making changes to my code, and it’ll be easier if I could be testing directly from the ide. – Uchechi Ugo 1 min ago
Categories: Uncategorized