<div dir="ltr">Hi Phil,<div><br></div><div>Thanks so much for taking a moment to look at this. </div><div><br></div><div>I realized that the problem I was having was with the zsh shell on macOS. I reverted back to the bash shell, ran the short script and had no issues with the code. </div><div><br></div><div>Thanks,</div><div>Joshua Willman</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 9, 2021 at 6:28 AM Phil Thompson <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On 08/11/2021 08:14, RedHuli wrote:<br>
> Hello,<br>
> <br>
> I was wondering if someone could help me with my issue. I want to <br>
> update my<br>
> code from PyQt5 to PyQt6. I need to use QCamera, but every time I do I <br>
> get<br>
> the following error:<br>
> <br>
> zsh: segmentation fault<br>
> /Library/Frameworks/Python.framework/Versions/3.9/bin/python3<br>
> test_camera.py<br>
> <br>
> <br>
> No matter what I do, I still get an error. I've played around with<br>
> QMediaPlayer and QVideoWidget. I am not sure which new classes to use <br>
> in<br>
> PyQt6 to get the camera to play. Below is the minimum code (I believe)<br>
> should get the camera working:<br>
> <br>
> <br>
> # Import necessary modules<br>
> import sys<br>
> from PyQt6.QtWidgets import QApplication<br>
> from PyQt6.QtMultimedia import (QCamera, QMediaCaptureSession, <br>
> QMediaDevices<br>
> )<br>
> from PyQt6.QtMultimediaWidgets import QVideoWidget<br>
> <br>
> app = QApplication(sys.argv)<br>
> <br>
> video_widget = QVideoWidget()<br>
> video_widget.resize(640, 480)<br>
> video_widget.show()<br>
> <br>
> camera = QCamera(QMediaDevices.defaultVideoInput())<br>
> camera.start()<br>
> <br>
> mediaCaptureSession = QMediaCaptureSession()<br>
> mediaCaptureSession.setCamera(camera)<br>
> mediaCaptureSession.setVideoOutput(video_widget)<br>
> <br>
> sys.exit(app.exec())<br>
> <br>
> <br>
> Thanks for your help!<br>
> <br>
> <br>
> Joshua Willman<br>
<br>
It worked fine for me on macOS.<br>
<br>
Phil<br>
</blockquote></div>