-1

I'm trying to execute a script on my Raspberry Pi (Ubuntu MATE), which was working perfectly fine in my VM (Oracle VM Virtual Box/Ubuntu 15.10). On the Raspberry Pi, I've tried Raspbian and currently I'm running Ubuntu MATE (16.04) because I wanted to see if it works there.

Basically my script goes through a few lists and takes the first item of each one, after that run it changes and takes the second item of the last list etc. to search for information (flights) online. Basically it's a "try each combination of the items" The results are saved in different files.

I don't get an error, which is the strange thing. I've installed all the packages my script needs.

It just goes through one loop and gets "stuck". So, the terminal acts like it's still working but I don't get any more outputs. I end up getting one file, instead of 12...

I also have to close the console with Ctrl+Z.

Does anyone have an idea what could cause this issue?

Code: https://github.com/tuxeos/flightsearch/blob/master/flightfail.py

Output: https://raw.githubusercontent.com/tuxeos/flightsearch/master/output.md

I removed the website from the source code, because I don't want to get into any troubles. But the other code (except for the departure/arrival dates and the Airport codes) is the same.

The output from the execution in the VirtualBox is the same, it just continues after "Starting timer" and goes into the next loop.

Versions on Ubuntu (VM):

  • qt: 4.8.6
  • SIP: 4.16.9
  • PyQt: 4.11.4

Versions on Ubuntu MATE (Raspberry Pi 3):

  • qt: 4.8.7
  • SIP: 4.17
  • PyQt: 4.11.4
Ulf Gjerdingen
  • 1,414
  • 3
  • 16
  • 20

1 Answers1

0

EDIT: From this answer PyQt: app.exec_() stops all following code from running app.exec_() starts a blocking PyQt4 instance which is why further code isn't executed. You can interact with it via multiple ways outlined in that thread.

The question then is why does your first loop iteration run and not block when it calls app.exec_().


From the output it's getting stuck in your Render class on one of these two lines:

self.mainFrame().load(QUrl(url))  
self.app.exec_()

https://github.com/tuxeos/flightsearch/blob/master/flightfail.py#L30

To clarify, this exact script runs OK on your VM?

I'm not familiar with PyQT4 or the QWebPage class you inherit from, it looks like the Raspberry Pi is having issues with calling mainframe().load or app.exec_ for the second time.

I'd bet that

self.app = QApplication.instance() 

is returning the same instance in the second iteration of your loop, and calling mainframe().load or app.exec_ on an instance that's already had one of these called is an issue. Maybe try re-using the same instance?

The python debugger pdb is your friend here (or an IDE like PyCharm). It'll help you identify exactly what line of your code is failing, and also will let you debug into the PyQt4 code to see where it fails.

RedCraig
  • 503
  • 1
  • 4
  • 15