From SweepMe! Wiki
Jump to: navigation, search

Whenever you create a Device Class or a Module, you might need to access error messages to debug your code.

Debug console

SweepMe! redirects all error and print messages to the Debug console which can be accessed via the key 'F2' or the menu 'Window' -> 'Debug'. Furthermore, the Debug console is a permanent widget of the Docking station window. If you cannot see it, then it is simply hidden. You can show the Debug console if you right-click on the header of any DockWidget in the DockingStation and select 'Debug' again.


All debug messages will also be saved to the file 'debug.log' that you can find in the installation path of your SweepMe! version. This file can be used to create a support ticket. Please make sure that no personal information are sent. Furthermore, whenever SweepMe! starts, the debug.log will be emptied. Please make sure that you do not overwrite delete any debug message by restarting As SweepMe! opens the file debug.log, the content cannot be accessed until SweepMe! is closed. To check whether the file debug.log contains all error messages, you can make a copy of it.

Program startup

The debug.log also contains all error message that occur during the startup of your program. Thus, if SweepMe! does not start correctly, you can check the error messages using the debug file. Alternatively, you can start SweepMe! by open Windows command line in the the SweepMe! installation folder and type in "SweepMe!.exe". The option '-d' will result in further debug messages that might help us to identify your problem if you create a support ticket. In this case, you have to use "SweepMe!.exe -d"

Device Classes

Any print-statement inside your Device Class will lead to an output via the the Debug console. Thus, you can output whatever is needed to debug your code. Whenever, your Device Class is used, e.g. by running a measurement or pushing buttons like 'Retrieve' or "Apply', SweepMe! checks whether the code has been changed and reloads the Device Class. A restart of SweepMe! is not needed.




You can import from SweepMe!'s module ErrorMessage two convenience functions called 'error' and 'debug'

from ErrorMessage import error, debug


error("<your message>")

will print <your message> and the last Exception that has been raised. It is typically used in combination with try-except

debug("<your message>")

will print <your message> starting with a time stamp