• 카테고리

    질문 & 답변
  • 세부 분야

    데이터 분석

  • 해결 여부

    미해결

QtwebEngine 관련 에러가 발생합니다

18.04.04 15:44 작성 조회수 452

0

안녕하세요. 오늘 강의중에 조금 다른부분이 있어서 그런지

에러가 나와서 문의드립니다.

저는 섹션6강의를 오늘 시작했는데요

QTPY5에 강의중에는 없었던 QWebEngineView가 있었습니다.

나중에 변경할거라고 해서 저는 그냥 저것을 선택해서 진행하였는데

ui파일을 py로 변경하는순간부터 에러가 발생합니다.

(그 전 단계까지는 순조롭게 따라갔습니다.)

에러의 문구는 다음과 같습니다.

Traceback (most recent call last):

File "/Users/jeongho/Documents/section6/main.py", line 5, in <module>

from lib.YouViewerLayout import Ui_MainWindow

File "/Users/jeongho/Documents/section6/lib/YouViewerLayout.py", line 147, in <module>

from QtWebEngineWidgets.QWebEngineView import QWebEngineView

ImportError: No module named 'QtWebEngineWidgets'

왜 이런 문구가 나오는지 강의영상을 다시보다가 선생님의 변환된 py파일의

147번줄이 저와는 다르더라고요

저는

' from QtWebEngineWidgets.QWebEngineView import QWebEngineView ' 이렇게 나오는데 선생님의 파일에는

' from PyQt5 import QtWebEngineWidgets ' 라고 적혀있는걸 봤습니다.

변환시킨것이고 직접 작성하신게 아니지만 똑같은 과정을 거쳤는데 왜 서로 다른건지..

물론 선생님의 문구를 그대로 제껄로 옮겨서 작성하면 에러가 역시 나옵니다.

Traceback (most recent call last):

File "/Users/jeongho/Documents/section6/main.py", line 18, in <module>

you_viewer_main = Main()

File "/Users/jeongho/Documents/section6/main.py", line 14, in __init__

self.setupUi(self)

File "/Users/jeongho/Documents/section6/lib/YouViewerLayout.py", line 44, in setupUi

self.webView = QWebEngineView(self.groupBox_2)

NameError: name 'QWebEngineView' is not defined

이렇게요.

제가 작성했던 소스는

import sys

from PyQt5.QtWidgets import *

from PyQt5 import QtCore

from PyQt5 import uic

from lib.YouViewerLayout import Ui_MainWindow

import re

import datetime

#form_class = uic.loadUiType("/Users/jeongho/Documents/section6/ui/modubada_ver1.0.ui")[0]

class Main(QMainWindow, Ui_MainWindow):

def __init__(self):

super().__init__()

self.setupUi(self)

if __name__ == "__main__":

app = QApplication(sys.argv)

you_viewer_main = Main()

you_viewer_main.show()

app.exec_()

잘못된점 지적좀 부탁드립니다.ㅜ_ㅜ

섹션마다 질문이 많아서 죄송합니다.

답변 4

·

답변을 작성해보세요.

0

저 같은 경우 커맨드를 통해 py파일로 변환하지않고 디자이너의 '메뉴-폼-파이썬코드보기'를 통해 코드를 카피했더니 질문자님과 동일한 증상이 나왔고, 영상에서처럼 직접 변환을 하면 선생님 처럼 나왔습니다.  

0

네 안녕하세요.
음 변환할 때 옵션 값이 문제인것같기도하고. 처음보는 현상이네요.
지금 UI 파일에서는 특별한 문제가 없어 보입니다.
현재 정보로는 문제 해결이 쉽지 않겠네요.
우선은 제 소스파일로 작업을 진행하시는게 좋을 것같습니다.
어차피 UI파일은 *.py 파일로 변환해서 사용하려는 목적이 크기 때문에 큰 문제는 없어보입니다.
맥 상에서 고유의 문제일수도 있겠구요.
또는 ui파일을 py로 변환해주는 pyuic 모듈의 버전의 문제일 수도 있겠구요.
결론은 작동되는 파일로 작업을 진행하시는게 좋을것같습니다.
열심히 하는 모습 보기 좋습니다.
감사합니다.

0

나르샤님의 프로필

나르샤

질문자

2018.04.04

안녕하세요 선생님 빠른답변 감사드립니다.

main.py에는 이미 다른 뒷 과정들의 소스도 첨삭이 되서 그런지 안되는것 같아서

lib 폴더의 직접하셨던 YouViewerLayout.py 파일을 제 lib폴더에 옮겨서 했더니

정상 작동 하더라고요. ( PyQt5 도 재설치해봤습니당. )

그럼 UI파일이나 변환한 PY파일이 문제일것 같은데 말씀하신데로 UI파일을 아래에 붙이겠습니다.

<?xml version="1.0" encoding="UTF-8"?>

<ui version="4.0">

<class>MainWindow</class>

<widget class="QMainWindow" name="MainWindow">

<property name="geometry">

<rect>

<x>0</x>

<y>0</y>

<width>800</width>

<height>727</height>

</rect>

</property>

<property name="sizePolicy">

<sizepolicy hsizetype="Fixed" vsizetype="Fixed">

<horstretch>0</horstretch>

<verstretch>0</verstretch>

</sizepolicy>

</property>

<property name="minimumSize">

<size>

<width>800</width>

<height>727</height>

</size>

</property>

<property name="maximumSize">

<size>

<width>800</width>

<height>727</height>

</size>

</property>

<property name="windowTitle">

<string>MainWindow</string>

</property>

<property name="windowIcon">

<iconset>

<normaloff>/Users/jeongho/Documents/section6/resource/favicon.png</normaloff>/Users/jeongho/Documents/section6/resource/favicon.png</iconset>

</property>

<widget class="QWidget" name="centralwidget">

<widget class="QGroupBox" name="groupBox">

<property name="geometry">

<rect>

<x>9</x>

<y>2</y>

<width>231</width>

<height>381</height>

</rect>

</property>

<property name="title">

<string>기본정보</string>

</property>

<widget class="QLabel" name="label">

<property name="geometry">

<rect>

<x>18</x>

<y>30</y>

<width>200</width>

<height>101</height>

</rect>

</property>

<property name="text">

<string/>

</property>

<property name="pixmap">

<pixmap>/Users/jeongho/Documents/section6/resource/logo.png</pixmap>

</property>

</widget>

<widget class="QPushButton" name="pushButton">

<property name="geometry">

<rect>

<x>6</x>

<y>130</y>

<width>221</width>

<height>60</height>

</rect>

</property>

<property name="text">

<string>인 증</string>

</property>

</widget>

<widget class="QCalendarWidget" name="calendarWidget">

<property name="geometry">

<rect>

<x>10</x>

<y>190</y>

<width>211</width>

<height>181</height>

</rect>

</property>

</widget>

</widget>

<widget class="QGroupBox" name="groupBox_2">

<property name="geometry">

<rect>

<x>250</x>

<y>0</y>

<width>541</width>

<height>381</height>

</rect>

</property>

<property name="title">

<string>미리보기</string>

</property>

<widget class="QWebEngineView" name="webView" native="true">

<property name="geometry">

<rect>

<x>10</x>

<y>29</y>

<width>521</width>

<height>341</height>

</rect>

</property>

<property name="url">

<url>

<string>about:blank</string>

</url>

</property>

</widget>

</widget>

<widget class="Line" name="line">

<property name="geometry">

<rect>

<x>10</x>

<y>383</y>

<width>781</width>

<height>16</height>

</rect>

</property>

<property name="orientation">

<enum>Qt::Horizontal</enum>

</property>

</widget>

<widget class="QGroupBox" name="groupBox_3">

<property name="geometry">

<rect>

<x>10</x>

<y>390</y>

<width>401</width>

<height>271</height>

</rect>

</property>

<property name="title">

<string>다운로드URL 저장 위치 지정</string>

</property>

<widget class="QLabel" name="label_4">

<property name="geometry">

<rect>

<x>14</x>

<y>50</y>

<width>81</width>

<height>21</height>

</rect>

</property>

<property name="text">

<string>Video URL: </string>

</property>

</widget>

<widget class="QLabel" name="label_5">

<property name="geometry">

<rect>

<x>18</x>

<y>100</y>

<width>81</width>

<height>21</height>

</rect>

</property>

<property name="text">

<string>Save To :</string>

</property>

</widget>

<widget class="QLabel" name="label_6">

<property name="geometry">

<rect>

<x>16</x>

<y>150</y>

<width>81</width>

<height>21</height>

</rect>

</property>

<property name="text">

<string>Stream :</string>

</property>

</widget>

<widget class="QLineEdit" name="lineEdit">

<property name="geometry">

<rect>

<x>90</x>

<y>47</y>

<width>241</width>

<height>31</height>

</rect>

</property>

</widget>

<widget class="QPushButton" name="pushButton_2">

<property name="geometry">

<rect>

<x>333</x>

<y>44</y>

<width>61</width>

<height>41</height>

</rect>

</property>

<property name="text">

<string>확인</string>

</property>

</widget>

<widget class="QLineEdit" name="lineEdit_2">

<property name="geometry">

<rect>

<x>89</x>

<y>100</y>

<width>241</width>

<height>31</height>

</rect>

</property>

</widget>

<widget class="QToolButton" name="toolButton">

<property name="geometry">

<rect>

<x>338</x>

<y>100</y>

<width>51</width>

<height>31</height>

</rect>

</property>

<property name="text">

<string>...</string>

</property>

</widget>

<widget class="QComboBox" name="comboBox">

<property name="geometry">

<rect>

<x>90</x>

<y>147</y>

<width>301</width>

<height>31</height>

</rect>

</property>

</widget>

<widget class="QPushButton" name="pushButton_3">

<property name="geometry">

<rect>

<x>200</x>

<y>190</y>

<width>91</width>

<height>71</height>

</rect>

</property>

<property name="text">

<string>다운시작</string>

</property>

</widget>

<widget class="QPushButton" name="pushButton_4">

<property name="geometry">

<rect>

<x>300</x>

<y>190</y>

<width>91</width>

<height>71</height>

</rect>

</property>

<property name="text">

<string>창 닫기</string>

</property>

</widget>

</widget>

<widget class="QGroupBox" name="groupBox_4">

<property name="geometry">

<rect>

<x>420</x>

<y>390</y>

<width>371</width>

<height>271</height>

</rect>

</property>

<property name="title">

<string>로그(LOG)</string>

</property>

<widget class="QPlainTextEdit" name="plainTextEdit">

<property name="geometry">

<rect>

<x>10</x>

<y>29</y>

<width>351</width>

<height>231</height>

</rect>

</property>

</widget>

</widget>

<widget class="Line" name="line_2">

<property name="geometry">

<rect>

<x>10</x>

<y>663</y>

<width>781</width>

<height>16</height>

</rect>

</property>

<property name="orientation">

<enum>Qt::Horizontal</enum>

</property>

</widget>

<widget class="QLabel" name="label_2">

<property name="geometry">

<rect>

<x>20</x>

<y>680</y>

<width>91</width>

<height>16</height>

</rect>

</property>

<property name="text">

<string>브라우저 로딩</string>

</property>

</widget>

<widget class="Line" name="line_3">

<property name="geometry">

<rect>

<x>100</x>

<y>681</y>

<width>16</width>

<height>16</height>

</rect>

</property>

<property name="orientation">

<enum>Qt::Vertical</enum>

</property>

</widget>

<widget class="QProgressBar" name="progressBar">

<property name="geometry">

<rect>

<x>110</x>

<y>674</y>

<width>261</width>

<height>31</height>

</rect>

</property>

<property name="value">

<number>0</number>

</property>

</widget>

<widget class="QProgressBar" name="progressBar_2">

<property name="geometry">

<rect>

<x>520</x>

<y>674</y>

<width>271</width>

<height>31</height>

</rect>

</property>

<property name="value">

<number>0</number>

</property>

</widget>

<widget class="QLabel" name="label_3">

<property name="geometry">

<rect>

<x>430</x>

<y>680</y>

<width>91</width>

<height>16</height>

</rect>

</property>

<property name="text">

<string>다운로드 진행률</string>

</property>

</widget>

<widget class="Line" name="line_4">

<property name="geometry">

<rect>

<x>510</x>

<y>681</y>

<width>16</width>

<height>16</height>

</rect>

</property>

<property name="orientation">

<enum>Qt::Vertical</enum>

</property>

</widget>

</widget>

<widget class="QStatusBar" name="statusbar"/>

</widget>

<customwidgets>

<customwidget>

<class>QWebEngineView</class>

<extends>QWidget</extends>

<header location="global">QtWebEngineWidgets/QWebEngineView</header>

</customwidget>

</customwidgets>

<resources/>

<connections/>

</ui>

부탁드릴게요~감사합니다.

0

오 안녕하세요. 나르샤님

NameError: name 'QWebEngineView' is not defined

지금 엔진뷰를 못찾는 현상인데 우선은

  1. 예제 소스파일의 제가 만든것을 그대로 실행해서 작동이 되는지 확인하세요.

    -> 작동이 안된다면, pip uninstall 활용해서 pyqt5 지우고 다시 설치 해보실래요?

  2. 그래도 안된다면 나르샤님의 modubada_ver1.0.ui 요 파일 내용을 그대로 복사해서 붙여넣기 해주세요.
  3. 그럼 제가 실행해 보겠습니다.

감사합니다.