getting extremely confusing error even though all code seems to be okay, with correct syntax. Any help? Im pretty new to programming and Im getting this error when I run it, (Im using reple.it btw):
Traceback (most recent call last):
File "main.py", line 3 in <module>
from PyQt5.QtWidgets import *
ImportError: libGL.so.1:cannot open shared object file:
no such file directory
and my code is:
import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.browser = QWebEngineView()
self.browser.setUrl(QUrl('https://google.com'))
self.setCentralWidget(self.browser)
self.showMaximized()
navbar = QToolBar()
self.addToolBar(navbar)
back_btn = QAction('Back', self)
back_btn.triggered.connect(self.browser.back)
navbar.addAction(back_btn)
forward_btn = QAction('Forward', self)
forward_btn.triggered.connect(self.browser.forward)
navbar.addAction(forward_btn)
reload_btn = QAction('Reload', self)
reload_btn.triggered.connect(self.browser.reload)
navbar.addAction(reload_btn)
home_btn = QAction('Home', self)
home_btn.triggered.connect(self.navigate_home)
navbar.addAction(home_btn)
self.url_bar = QLineEdit()
self.url_bar.returnPressed.connect(self.navigate_to_url)
navbar.addWidget(self.url_bar)
self.browser.urlChanged.connect(self.update_url)
def navigate_home(self):
self.browser.setUrl(QUrl('https://google.com'))
def navigate_to_url(self):
url = self.url_bar.text()
self.browser.setUrl(QUrl(url))
def update_url(self, q):
self.url_bar.setText(q.toString())
app = QApplication(sys.argv)
QApplication.setApplicationName("Adrians first browser")
window = MainWindow()
app.exec()
Any fixes? (Sorry if my question is stupid, I'm still new to coding
Your question is not that silly. Basically, libGL.so.1 is a dynamic-linked library, provided from package libgl1
.
Assuming you're on Linux, on a Debian or Ubuntu machine, a first step would be:
sudo apt-get update
sudo apt-get install libgl1
That might not be sufficient, and in that case, silly or not, I strongly encourage you to Google the exact error: you would have found this answer, which gives you alternatives to solve your problem (if you're new to programming, it's something to keep in mind!).