March 2009
3 posts
1 tag
MySQL Remote Database Transfers
One-liner to remote copy a MySQL database over SSH: mysqldump [db] | ssh -C [host] 'mysql [db]' For anything more complicated there is also taps.
Mar 9th
1 tag
Reflection and Introspection Over Modules and...
Someone Twitter me if I’m missing something, but I couldn’t find a core way of doing reflection over packages in Python. In this particular case, I wanted a way to load all the modules in a certain package (a directory with an __init__.py) and automatically add them into a running Twisted service. To get this working, I created a small module called reflection: import os import sys import...
Mar 6th
1 tag
Killing Python: Exiting Without Using SystemExit
Usually in python you exit a script programmatically by raising SystemExit or calling sys.exit. Both methods send an exception hurtling up the call stack, allowing every level of your program to execute finally statements and exit cleanly. This behaviour changes if you throw SystemExit in a multithreaded application: it kills the calling thread instead. If the calling thread is not the main...
Mar 5th