(V4L2: /dev/video0) can't open camera by index - python

I have an error on my algorithm with Jetson Xavier NX. I try to run code but terminal say that :
[ WARN:0] global /home/arc/opencv_build/opencv/modules/videoio/src/cap_v4l.cpp (890) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
Traceback (most recent call last):
File "realtime_quadrant.py", line 41, in
height = frame.shape
AttributeError: 'NoneType' object has no attribute 'shape'
This means that I have to change 0 in camera = cv2.VideoCapture(0).
So I try
cv2.VideoCapture(1),
cv2.VideoCapture(-1)
cv2.VideoCapture(cv2.CAP_V4L2)
yet I still have the same error. Also I installed V4l2 ( Sudo apt-get install v4l2) How can I do that to run?

Related

Python Ice connection refused

I am trying to install a murmur rest-api but I can't start it.
When I try to start the api, I have an error comming from Ice
Traceback (most recent call last):
File "runserver.py", line 1, in <module>
from app import app
File "/home/Mumble/app/__init__.py", line 48, in <module>
meta = Murmur.MetaPrx.checkedCast(proxy)
File "/home/Mumble/Murmur.ice", line 6211, in checkedCast
Ice.ConnectionRefusedException: Ice.ConnectionRefusedException:
Connection refused
!! 06/11/22 11:55:54.455 error: communicator not destroyed during global destruction.
I installed Ice correctly (sudo apt-get install python-zeroc-ice zeroc-ice-compilers) and I tried looking on online forums for answers without finding one thread about this.
Thank you.

CentOS 7 Installation Error anaconda NoSuchGroup

I'm trying to install CentOS 7 on virtual box but I faced this issue
after I Select the language it shows an error as the following
anaconda 21.48.22.93-1 exception report raceback (most recent call first): File H/usr/lib64/python2.7/site-packages/pyanaconda/packaging/yumpayload.py", line 1193, ir
raise NoSuchGroup(groupid, required=required) File H/usr/lib64/python2.7/site-packages/pyanaconda/packaging/yumpayload.py", line 1306, ir self._selectYumGroup(°core")
this message is not the full message I used the OCR to extract the text from image because I cant copy the text from VBox you can view the next image to see

Python script using PIL works in IDE doesn't when run by cmd and gives 'PIL' has no attribute 'Image'

When I run the following in the Spyder IDE on Win10:
import PIL
import os
Inboundfile = "C:/Test/test/Overlay.png"
image = PIL.Image.open(os.path.abspath(Inboundfile))
image.show()
It works fine. Opens the picture and outputs:
runfile('C:/Users/bob/Anaconda3/envs/NewEnvironment/bob/test3.py', wdir='C:/Users/bob/Anaconda3/envs/NewEnvironment/bob')
But when I call the same script from a cmd prompt:
C:\Users\bob\Anaconda3\envs\NewEnvironment\bob>python test3.py
It results in:
Traceback (most recent call last):
File "test3.py", line 14, in <module>
image = PIL.Image.open(os.path.abspath(Inboundfile))
AttributeError: module 'PIL' has no attribute 'Image'
I have verified that the environment path is pointing to the same python environment as the IDE. ( I think ) Here is my Path variable from OS
C:\Users\bob\Anaconda3\envs\NewEnvironment\
It's probably something very simple but I'm very new at this and any help would be appreciated.
I tried adding the line:
from PIL import Image
It still runs fine in the IDE but the error message changes to:
C:\Users\bb\Anaconda3\envs\NewEnvironment\bob>python test3.py
Traceback (most recent call last):
File "test3.py", line 11, in <module>
from PIL import Image
File "C:\Users\bob\Anaconda3\envs\NewEnvironment\lib\site-packages\PIL\Image.py", line 69, in <module>
from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.
This is even more confusing as I can follow that path and see Image.py sitting in the directory. What is the IDE doing that CMD is not?
All of my problems vanished when I simply closed and restarted the console I was using to call the python script. I have learned that the console saves things like the path variables when it starts up and must be restarted to get changes.

Getting Error "NameError: name 'TLSExtSupportedGroup' is not defined" while executing the program

I am trying to execute the program full_rsa_connection_with_application_data.py given here. However, I dont know why I am getting the following error
Traceback (most recent call last):
File "full_rsa_connection_with_application_data.py", line 21, in <module>
extensions = [TLSExtension() / TLSExtECPointsFormat(),TLSExtension()/ TLSExtSupportedGroup()]
NameError: name 'TLSExtSupportedGroup' is not defined
How can I proceed further?
With pip install you are installing the code of the release 1.2.3.2 so you should try this example instead:
https://github.com/tintinweb/scapy-ssl_tls/blob/release/1.2.3/examples/full_rsa_connection_with_application_data.py
The example you linked there is working from the master branch at is has classes the release hasnt like TLSExtSupportedGroup

Attribute Error occurs when performing division in PyCharm 5.0.2

I'm working on a Windows 64-bit machine and using Python 3.4 and PyCharm 5.0.2. I find that PyCharm gives me error even when I'm doing tasks as simple as divisions:
up = 22.33695
down = 1.2598
this = up/down
It gives me this error message:
Error evaluating: thread_id: pid7636_seq2
frame_id: 54197704
scope: FRAME
attrs: this
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 5.0.2\helpers\pydev\pydevd_vars.py", line 238, in resolveCompoundVariable
return resolver.getDictionary(var)
AttributeError: 'NoneType' object has no attribute 'getDictionary'
I really can't understand where I did wrong or if this is a bug in PyCharm. Can you help?

Categories