Log Message
Note to self: when you get time, figure out how to do logging, as a general practice: here is a nice link to get you started.
Note to self: when you get time, figure out how to do logging, as a general practice: here is a nice link to get you started.
Note to self: when you get time, figure out how to do logging, as a general practice: here is a nice link to get you started.
Sometimes, a python script just gives up and hangs. Even Ctrl-C does not exit the program. You do not have to have a loop with a catch-all except command or ...
To better visualize the call tree after profiling a python script, first save your output from cProfile using python -m cProfile -o <myscript.profile> ...
For an introduction to extending python using C, via PyObject and the like, take a look at this tutorial.
For more general info on making and installing your own packages, take a look at this page.
To make virtualenv find your user-defined module, assuming you are using virtualenvwrapper, you can simply use the add2virtualenv command.
To make a user-defined python module that you can import in many scripts, you must place your module in one of the site-packages directories in sys.path. If ...
To install cvxopt linked to Intel MKL using pip, set environment variables in the installation commands as follows: sudo CVXOPT_BLAS_LIB_DIR=/opt/intel/mkl/l...
How do you automatically get vim to do PEP8-style indentation for python code? Look up this blog post which references this vim script. It has also been adde...
To remove lines the object oriented way in matplotlib (using axes, etc.) take a look at my tuner program for an example. Alternatively, look at the fitzhugh-...
Use the select module in python for non-blocking input. Look at my tuner program for an example of its usage.
Use the builtin bin() function to convert integers to binary. Use int(binary_repr, 2) to convert back.
In order to check errors in python formatting, use pep8 (installed with pip). In order to correct these errors automatically, use autopep8.
If you want to debug a C or C++ program that has a python frontend, then run python using gdb. Then, inside gdb, use the set args command to set the python s...