NXT-PYTHON.CONF(5)
π nxt-python.conf β the NXT-Python manual, section 5 π
okay bestie, so this is the page for nxt-python.conf from the NXT-Python docs. sit down, get a snack, we're doing config files π
β¨ NAME β¨
nxt-python.conf β the NXT-Python configuration file. that's it, that's the name. iconic. π
πΈ DESCRIPTION πΈ
so like. the NXT-Python config files let you define the NXT bricks you want to connect to, so you don't have to keep passing the same argument to every single script like a peasant. periodt. β¨
you can drop a .nxt-python.conf in your home directory, or in the current directory. you can also explicitly hand a config file name to the script or function you're invoking. your call, bestie, all three work. π«Ά
π FORMAT π
the vibe here is INI-style. it's made of several sections, and a section gets introduced by its name sitting in square brackets on its own line. each section holds a bunch of key/value pairs, and the key and the value are separated by an equal sign (=). very demure, very simple. π
config can also have comments, and a comment starts with a # character.
when you're out here looking for a brick, you can ask NXT-Python to use a specific section, or [default] if you didn't specify one. if the section is missing, or if a value is missing, then the [DEFAULT] section is used as the fallback β note the uppercase, bestie, that part is not a typo, it's literally [DEFAULT]. π
here's everything you can define:
backendsβ the space separated list of backends to use when finding and connecting to the brick. when you don't specify it, a default list of backends gets used:devfile<#module-nxt.backend.devfile> iffilenameis given,socket<#module-nxt.backend.socket> ifserver_hostorserver_portis given,usb<#module-nxt.backend.usb> and,bluetooth<#module-nxt.backend.bluetooth>.
nameβ the brick name, used to find the brick (for example:NXT). you can configure the brick name using the NXT brick menus. π§hostβ the Bluetooth address used to find the brick (for example:00:16:53:01:02:03). when you're using the Bluetooth backend, this lets you connect directly without having to scan around to find the brick. for other backends, it can be used to select the right brick when several bricks turn up. β¨
you can find the address in the "Settings" menu, under the "NXT Version" screen β it's the last line, labeled "ID". add the colon to separate each pair of digits. (yes, you have to add the colons yourself. the brick is not gonna do it for you. π)
server_hostβ server address or name (example:192.168.1.3, orlocalhost).
this one is used by the socket backend.
the server is provided by the nxt-server(1) command.
server_portβ server connection port (default:2727).
this is used by the socket backend.
the server is provided by the nxt-server(1) command.
filenameβ device file name (default is platform specific).
this is used by the devfile <#module-nxt.backend.devfile> backend to locate the RFCOMM device file.
please see the NXT-Python documentation for more details on how to use this. π
- Other values β other values are passed as-is to backends. no notes, they just go straight through. π
π₯ EXAMPLE π₯
say you've got this config file:
[DEFAULT]
# Defines a fallback for every configuration name.
backends = usb
[default]
# My default NXT, sitting on my desk.
host = 00:16:53:01:02:03
name = NXT
[lab]
# When working at the lab, use my second NXT.
name = NXT2
[robot]
# Use Bluetooth for my third NXT, which is embedded in a robot, but try USB
# first as this is faster.
backends = usb bluetooth
host = 00:16:53:aa:bb:cc
name = ROBOT
when you're on the command line, NXT-Python connects to my default NXT if I don't give more options:
$ nxt-test
Finding brick...
NXT brick name: NXT
...
and I can request to connect to my robot NXT brick like this:
$ nxt-test --config robot
Finding brick...
NXT brick name: ROBOT
...
or when I'm using a script:
import nxt.locator
b = nxt.locator.find(config="robot")
telling, honestly. π
π FILES π
$HOME/.nxt-python.confβ per user configuration file..nxt-python.confβ configuration file in current directory.
π SEE ALSO π
nxt-test(1)- NXT-Python documentation <<https://ni.srht.site/nxt-python/latest/>>
π«Ά Author π«Ά
this program is part of NXT-Python, which is currently maintained by Nicolas Schodet. thank you for your service king π
π Copyright π
2021-2025, Nicolas Schodet
and that's the whole page bestie!! version 3.5.1, dated Jan 26, 2026 β go forth and configure your bricks, you're gonna slay π β¨ππ¦
π¦ where this page comes from
- ubuntu resolute: python3-nxt 3.5.1-1build1
- ubuntu stonking: python3-nxt 3.5.1-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms