Closed superlou closed 5 years ago
Using PDB, and stepping over the OMXPlayer(...)
call, I believe the error is a failure to connect to the OMXPlayer process.
> /usr/local/lib/python3.7/dist-packages/omxplayer/player.py(154)__init__()->None
-> self.load(source, pause=pause)
(Pdb) l
149 #: Event called on setting position ``callback(player, absolute_position)``
150 self.positionEvent = Event()
151
152 self._process = None
153 self._connection = None
154 -> self.load(source, pause=pause)
155
156 def _load_source(self, source):
157 if self._process:
158 self.quit()
159
(Pdb) s
SystemError: DBus cannot connect to the OMXPlayer process
> /home/pi/workspace/pideck2/omx.py(18)play()
-> self.player = OMXPlayer(filename, args=['-b', '--no-osd', '-o', 'both']) #, '--loop'])
It definitely has something to do with executing in gevent. I switched to eventlet and it's working. I'm going to close this since I think it's a problem with my understanding of gevent, and not something in OMX player wrapper's DBUS access itself.
Hi @superlou can you explain how did you solve it, please ??
@jonra1993, unfortunately, I was never able to figure out how to fix it in gevent. You can see the app that runs on eventlet here: https://github.com/superlou/pideck. The connection happens at https://github.com/superlou/pideck/blob/master/omx.py#L25.
Thanks for your time @superlou. I am not sure what happened with my python script but I cloned omxplayer examples and they worked so I decided just edit examples.
Issue Report
Note that I've heavily edited this issue. My initial magical diagnosis of a Python code execution halt without an exception was way off base.
Description
I just updated from Stretch to Buster, and I'm receiving
SystemError: DBus cannot connect to the OMXPlayer process
when callingOMXPlayer(...)
. This only seems to happen when trying to create the player in a Flask route handler, but this was working on Stretch and I haven't found any documentation indicating this behaviour would change. I've also tried reverting to older Flask versions without any difference in symptoms.Problem reproduction
I have created a helper class to manage my communication with OMXPlayer in a Flask webserver.
The full project is on github.
If I instantiate this class and run in a Python 3 shell, everything works: the video plays and "here1" and "here2" are printed. If the web server calls
play
during configuration, it also works with the same behavior:However, if I call
play
from inside a route handler, "here1" is printed and the video plays, but "here2" is not printed and I receive theSystemError
.Is there anything in python-omxplayer-wrapper that might explain this change in behavior? Is there anything on Buster that could cause this? This approach worked under Stretch, though admittedly it's a fresh install, so it's possible that this is a symptom of something else.
Environment details
python-omxplayer-wrapper
0.3.2
python-dbus
(dpkg -s python-dbus
)1.2.8-3
python3-dbus
(dpkg -s python3-dbus
)1.2.8-3
python
(python --version
)3.7.3
omxplayer
(omxplayer --version
)f06235c