'LSOpenURLsWithRole() failed with error -10810 for the file /Users/gb/myapp/dist/MyApplication.app
Environment:
Python 3.8
Pyqt5
Mac OS X Catalina 10.15.6
I am trying to compile my python program in Mac OS application. I get this error message when I open the app:
(base) gb@MacBookGB % open dist/MyApplication.app
LSOpenURLsWithRole() failed with error -10810 for the file /Users/gb/myapp/dist/MyApplication.app.
I checked that files can be executed:
ld -la dist/
drwxr-xr-x@ 4 gb staff 128 26 aoû 20:27 .
drwxr-xr-x@ 223 gb staff 7136 26 aoû 20:44 ..
-rw-r--r--@ 1 gb staff 6148 26 aoû 21:04 .DS_Store
drwxr-xr-x@ 3 gb staff 96 26 aoû 20:18 MyApplication.app
ld -la dist/MyApplication.app/Contents/Mac OS/
total 7016
drwxr-xr-x@ 4 gauthierbtz staff 128 26 aoû 20:18 .
drwxr-xr-x@ 7 gauthierbtz staff 224 26 aoû 20:18 ..
-rwxr-xr-x@ 1 gauthierbtz staff 30048 26 aoû 20:18 PhoneBot_small
-rwxr-xr-x@ 1 gauthierbtz staff 3557260 26 aoû 20:18 python
So I searched everywhere on the web to find solution but none worked. As I know Qt5 can make issue when compiling, I made a search and found your article: [https://doc.qt.io/qtforpython/deployment-pyinstaller.html](link url)
I decide to compile your python code shown in this article.
import sys
import random
from PySide2.QtWidgets import (QApplication, QLabel, QPushButton,
QVBoxLayout, QWidget)
from PySide2.QtCore import Slot, Qt
class MyWidget(QWidget):
def __init__(self):
QWidget.__init__(self)
self.hello = ["Hallo Welt", "你好,世界", "Hei maailma",
"Hola Mundo", "Привет мир"]
self.button = QPushButton("Click me!")
self.text = QLabel("Hello World")
self.text.setAlignment(Qt.AlignCenter)
self.layout = QVBoxLayout()
self.layout.addWidget(self.text)
self.layout.addWidget(self.button)
self.setLayout(self.layout)
# Connecting the signal
self.button.clicked.connect(self.magic)
@Slot()
def magic(self):
self.text.setText(random.choice(self.hello))
if __name__ == "__main__":
app = QApplication(sys.argv)
widget = MyWidget()
widget.resize(800, 600)
widget.show()
sys.exit(app.exec_())
Then I run the command:
pyinstaller --name="MyApplication" --windowed MyApp.py
And I get exact same issue :
LSOpenURLsWithRole() failed with error -10810 for the file /Users/gb/myapp/dist/MyApplication.app.
I wonder if anyone already faced this issue and found a solution?
Solution 1:[1]
The -10810 error message seems to be a catch-all for errors in the executable file inside the app. For example, I have an app called Hello.app, and inside Hello.app/Contents/MacOS is a single executable script named Hello with two lines:
#!/bin/sh
osascript -e "display dialog \"Hello, world!\""
When I issue the command:
open Hello.app
or double-click the folder icon in Finder. I see the expected dialog box:
However, when I introduce a syntax error:
osascript -e "display dialog "Hello, world!\""
the open command fails with the error message:
LSOpenURLsWithRole() failed with error -10810 for the file /full/path/name/of/Hello.app
To find the real error message, execute the program inside your app directly from the command line. In my case, the command is:
Hello.app/Contents/MacOS/Hello
and the much more informative error message is:
./Hello: line 2: unexpected EOF while looking for matching `"'
Of course, I have no idea what the actual error in your program is, but I hope this helps you find it!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |