Trouble using picamera python module with raspberry pi 4 - Raspberry Pi Q&A, Help & Troubleshooting

Hello All,
I am using a raspberry pi4 with a bullseye os - 64 bit.
In a virtual environment, I used - "pip install picamera" - to install the module
Whenever I try to import picamera, I get the following error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/Documents/proj_trash_can/cam.py", line 2, in <module>
from picamera import PiCamera
File "/home/pi/Documents/proj_trash_can/venv/lib/python3.9/site-packages/picamera/__init__.py", line 72, in <module>
from picamera.exc import (
File "/home/pi/Documents/proj_trash_can/venv/lib/python3.9/site-packages/picamera/exc.py", line 41, in <module>
import picamera.mmal as mmal
File "/home/pi/Documents/proj_trash_can/venv/lib/python3.9/site-packages/picamera/mmal.py", line 49, in <module>
_lib = ct.CDLL('libmmal.so')
File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libmmal.so: cannot open shared object file: No such file or directory
Click to expand...
Click to collapse
I have updated and upgraded with sudo but to no luck. It seems I am missing a directory and some files. Requesting some guidance and help regarding this problem - I would be very grateful.
If any added information is needed to be provided from my side, kindly let me know how to do so and I will provide it.
Thank You.

Related

[Q] Error in Cyanogenmod 7 repo init

i get this error in repo cyanogenmod 7:
Fetching projects: 100% (238/238), done.
Syncing work tree: 71% (169/238) Traceback (most recent call last):
File "/home/utente/.repo/repo/main.py", line 238, in <module>
_Main(sys.argv[1:])
File "/home/utente/.repo/repo/main.py", line 220, in _Main
repo._Run(argv)
File "/home/utente/.repo/repo/main.py", line 125, in _Run
cmd.Execute(copts, cargs)
File "/home/utente/.repo/repo/subcmds/sync.py", line 360, in Execute
project.Sync_LocalHalf(syncbuf)
File "/home/utente/.repo/repo/project.py", line 688, in Sync_LocalHalf
head = self.work_git.GetHead()
File "/home/utente/.repo/repo/project.py", line 1380, in GetHead
fd = open(path, 'rb')
IOError: [Errno 2] No such file or directory: u'/home/utente/packages/apps/Bluetooth/.git/HEAD'
anyone know a solution??
Alberto96 said:
i get this error in repo cyanogenmod 7:
Fetching projects: 100% (238/238), done.
Syncing work tree: 71% (169/238) Traceback (most recent call last):
File "/home/utente/.repo/repo/main.py", line 238, in <module>
_Main(sys.argv[1:])
File "/home/utente/.repo/repo/main.py", line 220, in _Main
repo._Run(argv)
File "/home/utente/.repo/repo/main.py", line 125, in _Run
cmd.Execute(copts, cargs)
File "/home/utente/.repo/repo/subcmds/sync.py", line 360, in Execute
project.Sync_LocalHalf(syncbuf)
File "/home/utente/.repo/repo/project.py", line 688, in Sync_LocalHalf
head = self.work_git.GetHead()
File "/home/utente/.repo/repo/project.py", line 1380, in GetHead
fd = open(path, 'rb')
IOError: [Errno 2] No such file or directory: u'/home/utente/packages/apps/Bluetooth/.git/HEAD'
anyone know a solution??
Click to expand...
Click to collapse
Delete "/home/utente/packages/apps/Bluetooth" and try your repo sync again. It's possible your initial repo sync was interrupted.
ok , thanks for the solution . it worked .
please close this thread

Andbot

So i have been trying to brew up some ROMs for JB but I cant seen to get the repository working to sync the source code
Code:
AndBot:[email protected]:~/android/system$ andbot init
+ cd /home/andbot/android/system
+ exec repo init -u git://github.com/CyanogenMod/android.git -b jellybean
Traceback (most recent call last):
File "/home/andbot/android/system/.repo/repo/main.py", line 385, in <module>
_Main(sys.argv[1:])
File "/home/andbot/android/system/.repo/repo/main.py", line 365, in _Main
result = repo._Run(argv) or 0
File "/home/andbot/android/system/.repo/repo/main.py", line 137, in _Run
result = cmd.Execute(copts, cargs)
File "/home/andbot/android/system/.repo/repo/subcmds/init.py", line 319, in Execute
self._SyncManifest(opt)
File "/home/andbot/android/system/.repo/repo/subcmds/init.py", line 144, in _SyncManifest
r = m.GetRemote(m.remote.name)
File "/home/andbot/android/system/.repo/repo/project.py", line 615, in GetRemote
return self.config.GetRemote(name)
File "/home/andbot/android/system/.repo/repo/git_config.py", line 173, in GetRemote
r = Remote(self, name)
File "/home/andbot/android/system/.repo/repo/git_config.py", line 526, in __init__
self.review = self._Get('review')
File "/home/andbot/android/system/.repo/repo/git_config.py", line 656, in _Get
return self._config.GetString(key, all = all)
File "/home/andbot/android/system/.repo/repo/git_config.py", line 117, in GetString
return self.defaults.GetString(name, all = all)
File "/home/andbot/android/system/.repo/repo/git_config.py", line 114, in GetString
v = self._cache[_key(name)]
File "/home/andbot/android/system/.repo/repo/git_config.py", line 231, in _cache
self._cache_dict = self._Read()
File "/home/andbot/android/system/.repo/repo/git_config.py", line 238, in _Read
self._SavePickle(d)
File "/home/andbot/android/system/.repo/repo/git_config.py", line 275, in _SavePickle
os.remove(self._pickle)
OSError: [Errno 13] Permission denied: '/home/andbot/.repopickle_.gitconfig'
It doesn't look like a clean install of andbot. What OS are you using? Is it 32 or 64 bit? You need 64 bit for jb. I would try an new andbot install.
cmendonc2 said:
So i have been trying to brew up some ROMs for JB but I cant seen to get the repository working to sync the source code
Click to expand...
Click to collapse
bowguy said:
It doesn't look like a clean install of andbot. What OS are you using? Is it 32 or 64 bit? You need 64 bit for jb. I would try an new andbot install.
Click to expand...
Click to collapse
Im using Ubuntu 12.04 64 bit. I'll try a fresh install and see what happens.
That's the setup I use. Look for any warnings when you type andbot.run
cmendonc2 said:
Im using Ubuntu 12.04 64 bit. I'll try a fresh install and see what happens.
Click to expand...
Click to collapse

OmniROM for GT-i9300 Build Failure

Hi,
I successfully built the rom for a couple months on Ubuntu 13.10 following wiki's instructions, as an exercise on learning how to 'cherry-pick' stuff into a work-tree, now wanna add Hammerhead to the working tree BUT it seems that the building system for GT-I9300 is actually broken (maybe by an update?), here's the log:
mkdir -p /media/reS28raM/android/omni/out/target/product/i9300/obj/GYP/shared_intermediates/ui/jni; cd external/chromium_org/ui; ../base/android/jni_generator/jni_generator.py --input_file android/java/src/org/chromium/ui/WindowAndroid.java --output_dir "/media/reS28raM/android/omni/out/target/product/i9300/obj/GYP/shared_intermediates/ui/jni" --optimize_generation 0 --jarjar ../android_webview/build/jarjar-rules.txt
[32mImport includes file:[0m /media/reS28raM/android/omni/out/target/product/i9300/obj/STATIC_LIBRARIES/ui_ui_gyp_intermediates/import_includes
[32mExport includes file:[0m external/chromium_org/GypAndroid.linux-arm.mk -- /media/reS28raM/android/omni/out/target/product/i9300/obj/STATIC_LIBRARIES/ui_ui_gyp_intermediates/export_includes
Gyp action: Generating JNI bindings from /media/reS28raM/android/omni/prebuilts/sdk/17/android.jar/android/view/Surface.class (/media/reS28raM/android/omni/out/target/product/i9300/obj/GYP/shared_intermediates/ui/gl/jni/Surface_jni.h)
Traceback (most recent call last):
File "../../base/android/jni_generator/jni_generator.py", line 1070, in <module>
sys.exit(main(sys.argv))
File "../../base/android/jni_generator/jni_generator.py", line 1066, in main
options.optimize_generation)
File "../../base/android/jni_generator/jni_generator.py", line 1001, in GenerateJNIHeader
jni_from_javap = JNIFromJavaP.CreateFromClass(input_file, namespace)
File "../../base/android/jni_generator/jni_generator.py", line 514, in CreateFromClass
jni_from_javap = JNIFromJavaP(stdout.split('\n'), namespace)
File "../../base/android/jni_generator/jni_generator.py", line 457, in __init__
contents[1]).group('class_name')
AttributeError: 'NoneType' object has no attribute 'group'
make: *** [/media/reS28raM/android/omni/out/target/product/i9300/obj/GYP/shared_intermediates/ui/gl/jni/Surface_jni.h] Errore 1
make: *** Attesa per i processi non terminati....
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
real 4m21.228s
user 4m4.210s
sys 0m53.027s
Don't understand that reference to SDK API 17 at all, are you guys still using Ubuntu 13.10 to build OmniROM for Galaxy S3? Thx
reS28raM said:
Hi,
I successfully built the rom for a couple months on Ubuntu 13.10 following wiki's instructions, as an exercise on learning how to 'cherry-pick' stuff into a work-tree, now wanna add Hammerhead to the working tree BUT it seems that the building system for GT-I9300 is actually broken (maybe by an update?), here's the log:
mkdir -p /media/reS28raM/android/omni/out/target/product/i9300/obj/GYP/shared_intermediates/ui/jni; cd external/chromium_org/ui; ../base/android/jni_generator/jni_generator.py --input_file android/java/src/org/chromium/ui/WindowAndroid.java --output_dir "/media/reS28raM/android/omni/out/target/product/i9300/obj/GYP/shared_intermediates/ui/jni" --optimize_generation 0 --jarjar ../android_webview/build/jarjar-rules.txt
[32mImport includes file:[0m /media/reS28raM/android/omni/out/target/product/i9300/obj/STATIC_LIBRARIES/ui_ui_gyp_intermediates/import_includes
[32mExport includes file:[0m external/chromium_org/GypAndroid.linux-arm.mk -- /media/reS28raM/android/omni/out/target/product/i9300/obj/STATIC_LIBRARIES/ui_ui_gyp_intermediates/export_includes
Gyp action: Generating JNI bindings from /media/reS28raM/android/omni/prebuilts/sdk/17/android.jar/android/view/Surface.class (/media/reS28raM/android/omni/out/target/product/i9300/obj/GYP/shared_intermediates/ui/gl/jni/Surface_jni.h)
Traceback (most recent call last):
File "../../base/android/jni_generator/jni_generator.py", line 1070, in <module>
sys.exit(main(sys.argv))
File "../../base/android/jni_generator/jni_generator.py", line 1066, in main
options.optimize_generation)
File "../../base/android/jni_generator/jni_generator.py", line 1001, in GenerateJNIHeader
jni_from_javap = JNIFromJavaP.CreateFromClass(input_file, namespace)
File "../../base/android/jni_generator/jni_generator.py", line 514, in CreateFromClass
jni_from_javap = JNIFromJavaP(stdout.split('\n'), namespace)
File "../../base/android/jni_generator/jni_generator.py", line 457, in __init__
contents[1]).group('class_name')
AttributeError: 'NoneType' object has no attribute 'group'
make: *** [/media/reS28raM/android/omni/out/target/product/i9300/obj/GYP/shared_intermediates/ui/gl/jni/Surface_jni.h] Errore 1
make: *** Attesa per i processi non terminati....
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
real 4m21.228s
user 4m4.210s
sys 0m53.027s
Don't understand that reference to SDK API 17 at all, are you guys still using Ubuntu 13.10 to build OmniROM for Galaxy S3? Thx
Click to expand...
Click to collapse
Wrong Java version or Python version.
I was using OpenJDK and was happy to see it working, maybe it is time to switch to Oracle's
Sent from my Nexus 5 using Tapatalk

Leapcast (Ubuntu problem)

Hello guys!
Im very new on this site and i don't know if this is the right category but i was installing "leapcast" and then when i tried to start it.
It just says this:
Code:
INFO:root:Starting SSDP server
INFO:root:Starting LEAP server
INFO:root:Loading Config-JSON from Google-Server
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): clients3.google.com
/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Traceback (most recent call last):
File "/home/ubuntu/.virtualenvs/leapcast/bin/leapcast", line 9, in <module>
load_entry_point('Leapcast==0.1.3', 'console_scripts', 'leapcast')()
File "/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/leapcast/__main__.py", line 38, in main
leap_server.start()
File "/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/leapcast/services/leap.py", line 35, in start
resp = requests.get(url=app_dict_url)
File "/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/requests/api.py", line 67, in get
return request('get', url, params=params, **kwargs)
File "/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/requests/api.py", line 53, in request
return session.request(method=method, url=url, **kwargs)
File "/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/home/ubuntu/.virtualenvs/leapcast/local/lib/python2.7/site-packages/requests/adapters.py", line 447, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
(leapcast)[email protected]:~/leapcast$
Anyone know whats the problem?
System: Ubuntu 12.04 32bit.

Writing problems to log file Python Raspberry pi 2

By the first run python script nothing is written to the log file "cpu_temp.csv". When I run the second time then the data is written to the log file. The script is to extract the temperature from the temperature sensor MCP9808. I know the data is first written to "w1_slave" under the folder "/sys/bus/w1/devices/28-0115a4f575ff". The data for the log file are read always from this file. Can someone help me forwarding such that at the first startup script the data read from the sensor is written to the log file? I want the script started via cron. But since the first run doesn't work nothing has been logged.
Python script for reading data from MCP98808 and write to log file "cpu_temp.csv"
import subprocess
import logging
import time
from time import sleep, gmtime, strftime
import smbus
#Constant things, that don't change during run.
t_reg = 0x05
address = 0x18
bus = smbus.SMBus(1) # change to 0 for older RPi revision
def get_temp():
#The reading variable changes every time you run get_temp()
reading = bus.read_i2c_block_data(address, t_reg)
t = (reading[0] << 8) + reading[1]
temp = t & 0x0FFF
temp /= 16.0
if (t & 0x1000):
temp -= 256
return(temp)
with open("cpu_temp.csv", "a") as log:
while True:
temp = get_temp()
log.write("{0},{1}\n".format(strftime("%Y-%m-%d %H:%M:%S"),str(temp)))
time.sleep(10)
Output file cpy_temp.csv
2017-02-04 15:15:38,22.1875
2017-02-04 15:15:48,22.125
2017-02-04 15:15:58,22.125
2017-02-04 15:16:08,22.125
2017-02-04 15:16:18,22.125

Categories

Resources