Quelques tips pour debugger du code python avec print()
, notamment:
=
: print(f"{myvar=}")
locals()
to debug all local variables: print(locals())
vars()
to debug all of an object’s attributes: print(vars(myobject))
Pour sauvegarder un dump du kernel dans /var/crash sous debian en cas de kernel panic:
apt install kdump-tools crash kexec-tools makedumpfile `uname -r`-dbg
sed -i 's/USE_KDUMP=0/USE_KDUMP=1/' /etc/default/kdump-tools
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet" crashkernel=128M"/' /etc/default/grub
update grub
reboot
Pour debuguer un script Fabric avec PyCharm (IDE IntelliJ for Python)