Another blog post on Python

No Comments

Just another heads up that I posted another blog post at ExchangeTimes.Net on how to make a specific Python version the default version on Linux.

This is useful if you use one version of Python 90% + of the time and don’t want to specify which version of Python you want to run each time. You can find the post here.


Convert a PyQt ui file to a Python file on Linux

No Comments

Part of my Python programming module at Unisa is based on creating GUI applications using the Qt framework, PyQt5 to be more precise.

Unfortunately the study guide is based on Windows and not everything works the same way on Linux. The problem I had was not converting the .ui file as saved from Qt Designer to the .py file but with opening and running the application. The first conversion I did was straight from the guide as per below:

Read More…

Python from __future__ import syntax error

No Comments

At long last I got my Unisa registration for this semester sorted. Unfortunately I could only register for 2 modules (these cover C++ and Python) as it was extremely difficult to talk to a human at Unisa to find out what is going on.

Anyway! Busy working through the text book for INF1511 (Introduction to Python Programming and Developing GUI Applications with PyQT) I ran into a problem with importing the division module/class(?)

The import I need is for true division (from __future__ import division) and the book’s space are not really visible. I typed from__future__import division as per the text book and when I run the program received the below syntax error.

It took some digging and testing for me to find out that the statement should have a space in-front and after __future__ . It should be from (space) __future__ (space) import (space) division. i.e from __future__ import division. Note the 2 underscores before and after future.

Hope this helps anyone else that struggled to get this simple statement working.

Categories: Python