2026 May 7th – UQ PUG 28
Welcome to UQ Python User Group! Check out our general info for how we work and what we do. Below you’ll find the details of this month’s gathering.
Overview
Welcome to the May UQ PUG! Today we continue our 9-month series through The Python Tutorial.
This month, we’ll look at sections 4.8-4.9: More Control Flow Tools (Functions).
You can also add questions to our interactive document.
Structure
- We start today by adding our names to the table below
- Add your questions to this page
- This month’s presentation
- Finally, we spend the rest of the session answering the questions you’ve brought!
Teams
If you’d like to receive regular updates and post questions during the month, join our Teams channel!
Training Resources
We offer Python training sessions and resources, you can find our introductory guide here.
Questions
If you have any Python questions you’d like to explore with the group, please put your question and name in the sections below.
If you think you can help, feel free to contribute to the answers section!
Installing modules | Duncan
How to install modules with a restricted Microsoft store?
Answers
How you install modules depends on how Python was installed.
Most people either have a ‘pip’ install or a ‘conda’ install. If you’ve used Anaconda, you’ll have the latter. One way to check is to run
pip
in a terminal (not a Python console, e.g. Powershell). If you get nothing, it’s probably worked. If you get something to the tune of “Command not found”, then you don’t have pip, and should try conda.
To install your packages with pip:
pip install requests beautifulsoup4 lxml
pip install playwright
playwright install
To install your packages with conda
conda install requests beautifulsoup4 lxml
conda install playwright
playwright install
Note for others: playwright is itself a separate program with its own installation command (playwright install) which Duncan needed to use.
Calling C headers from Python
Can we call C headers (similar to Python modules but written in and for the language C) from Python?
Answers
Yes, with some work.
Python, as an interpreted language, needs to be written in some form of compiled language. This is referred to as the Python distribution - most people have CPython, Python written in C. The reason is that Python (can) interpret commands on-the-fly using a REPL (read-eval-print-loop); this is what you do when running line-by-line in the shell. For this to work, it needs to run a program behind the scenes to interpret your Python code, and this program needs to be written in something that the computer understands (machine code). Languages like C get compiled, which means the C code is converted into machine code (a binary file) which you then run whenever you like.
All of this is to say that most people use a distribution of Python written in C. If you are one of those people, there is some interfacing that you can do.
- Python in C: Yes. You can call Python modules and functions from C code from the header
Python.h - C in Python: Maybe. You can’t directly call C headers and functions from your code. Instead, you need to
For more information, including examples on extending your CPython distribution, have a look at the official guide.