Troubleshooting
The most frequent problems and their solutions.
Nothing is shown
- In the console, drawings, figures and windows are shown in the graphical output, not in a window: show it with the
button (which blinks when a new drawing is available) or
.
- With Turtle, end the drawing with
turtle.done()(see Turtle). - With Matplotlib, call
plt.show()(see Matplotlib). - An object (map, table, image…) is only shown by itself when it is the last value of a cell of the notebook. In the console, use
basthon.display(obj)(see Displaying objects).
The drawing does not react to the keyboard
Click in the drawing first (p5, Matplotlib figure, tkinter window): it only receives the keys afterwards.
The program does not stop
An infinite loop or a computation that takes too long does not block the page:
- in the console, restart the kernel with the
button;
- in the notebook, interrupt the kernel (■ button) or restart it.
If the page was closed during the run, Basthon notices it at the next load and offers to choose the backup to resume from.
I lost my code
Basthon keeps the last versions of the script or of the notebook in your browser: the button finds them again (see for the console and the notebook). These backups stay on the computer and the browser used: to keep your work, download it.
A shared file does not load
The site that hosts the file must allow it to be downloaded from another site (CORS). On a forge, the links to the "raw" file (…/-/raw/…) are refused: use the link generator, which converts the address of the page of the file (see Where to put your files?).
A Python module cannot be found
- Check that it is one of the available modules. If it is missing and written entirely in Python, install it with
micropip(see Python packages). - Packages are loaded according to the
importstatements of the code: a dynamic import (importlib.import_module) does not load a package that has not been imported yet. - Your own module must first be loaded with the open button (see Importing your own module).
A file of my computer cannot be found
The program has no access to your disk, only to Basthon's virtual filesystem: first load the file with the open button (see Using extra files).
A network request fails
In Python, only requests can query a site, and the site must allow requests coming from another site (CORS). urllib and socket do not work (see the differences with a computer).
The page stays on "Chargement de Basthon…"
- Check your Internet connection: Basthon downloads its files at the first load (the browser then keeps them).
- Update your browser: Basthon works with recent versions of Firefox, Chrome/Chromium and Edge. A browser that is too old shows a message.
- Reload the page.
The display is hard to read on a video projector
The dark mode has little contrast: switch to the light mode with the button, and enlarge the text with Ctrl++. Drawings, figures and windows have a full screen button, which appears when the mouse hovers over them.