I've spent the last 2 days trying to get a stack trace from a crashing python extension module in windows. And I still haven't figured it out. That's sooo very motivating.
Give me GNU/Linux any day.
I've spent the last 2 days trying to get a stack trace from a crashing python extension module in windows. And I still haven't figured it out. That's sooo very motivating.
Give me GNU/Linux any day.
Often it's nice to just have conventions and gentleman's agreements. But then sometimes someone doesn't and the harm is done, it's too hard to reverse.
NFS has introduced the de-facto standard of using <host>:<path> for the device of a remote mount. Yes this break because you can have ":" in …
Dear Lazy Web
I have some Very weird behaviour where the lowercase letters "C" and "V" stop generating the Correct key press event after a short while (which is why I am typing them as upper Case here...). But only when using Compiz as window manager, when switching away from …
So there's a PyCon UK 2009 Unconference. I wish I could go but have already planned to be on Pabbay and Mingulay in the Outer Hebrides, Scotland. So instead of hearing all about python I'll be clinging on to their amazing cliffs. Guess I'm not that bad off anyway...
Of course pdb has already got functions to start a debugger in the middle of your program, most notably pdb.set_trace(). This however requires you to know where you want to start debugging, it also means you can't leave it in for production code.
But I've always been envious of …
Integrating an automatic build on a windows host with the rest of your one-command cross-platform build system can be quite a pain. Luckily there is cygwin which makes things like ssh, bash, make etc all work on windows. It's great.
The trick to building using visual studio from there is …
It seems that if you need another module in a function of your extension module, the way modules in the standard library seem to solve this is like this:
static PyObject *
func(void)
{
PyObject *foo;
foo = PyImport_ImportModuleNoBlock("foo");
if (foo == NULL)
return NULL;
/* do stuff with foo */
Py_DECREF(foo);
return …
If you want a singleton in a C extension module for CPython you basically have to do the same as when doing this in plain Python: the .__new__() method needs to return the same object each time it is called. Implementing this has a few catches though.
static PyObject *
MyType_new …
Last Thursday I had the pleasure of being able to vote for the local council as well as for the European Parliament. Since I'm a Belgian citizen living in the United Kingdom this involved convincing the officials at the voting office to re-read their instructions (at first they only allowed …
It's not simply raising an exception in a thread that I want. I want to raise an exception in a thread from another thread. It's like sending signals to threads, only signals in pyhon can only be delivered to the main thread (for portability). But Python has a other asynchronous …
PSI, the Python System Information package that pulls interesting information from the kernel and makes it available in a nice Python API, has a new home at bitbucket. This means that the source conde now lives inside a mercurial repository instead of subversion.
This actually happened about a week ago …
Short summary: PSI is alive and we've just released the first beta of a much improved upcoming 0.3 release!
Back in 2007 Chris Miles announced PSI - Python System Information, a Python extension module to provide access to some system information not normally available to Python. Most notably it allows …
If you need to compile a random application in setup.py this is not that hard:
cc = distutils.ccompiler.new_compiler()
distutils.sysconfig.customize_compiler(cc)
cc.link_executable(['test.c'], 'a.out')
There is no need to create the object files explicitly with cc.compile() first if you have no need for …
The What's New in Python 2.6 document is very good and contains loads of information, congrats for making it. But it misses out a nice addition to the logging module: LoggerAdapter Objects. It allows you to create a logger object with extra contextual information really easy:
log = logging.LoggerAdapter …
Obviously the Sun Fire T1000 is a noisy machine, that's why it's sitting in the closet in the first place. But it has more shortcomings that make it a closet-unfriendly server:
Some memory in the back of my mind tells I've once read a rant about storing time that argued you should never store time in floating point variables. My memory seems to think the rant convinced me and it does indeed seem better to store time in integers so that …
I'm trying to read some pointers from a 64-bit address space file (from /proc/pid/as) while running in a 32-bit process - all this on Solaris. To do this I'm using the transitional large file compilation environment, i.e. where you get both open()/pread() and open64()/pread64() since I …
The screen of my Canon Digital Ixus 40 compact camera broke on my last trip (sport climbing in Geyikbayiri near Antalya, Turkey - if you climb: it's an amzing place!) which made me rather sad. But with the help of Ebay I found a new screen and have just managed to …
Dear World
Subject lines in emails are there for a reason.
Please use them.
Love
Floris
If you have ever looked at the ps(1) output on an AIX box and wondered why the virtual memory size (VSZ) is so small, often even smaller then the resident set size (RSS), then here's the answer: it's not the virtual memory size. It is actually the size of …
Developing against a closed source libraries is jut painful and wastes your time. Function definitions are missing from the header files, so you get to declare them yourself from the manpages. Then you get random error messages even though you do everything just like the manpage tells you. Some dark …
Dear Lazy Web
If I write the following in my ~/.ssh/config:
Host bartunnel
HostKeyAlias bar
HostName bar
LocalForward 8822 foo:22
Host barjump
HostKeyAlias bar
HostName localhost
Port 8822
Then I can connect to host bar via host foo (circumnavigating a firewall that stops me from going to bar …
So Debian has finally released again. Congratulations. Time to start planning upgrades of servers then.
If you ever feel the need to compile a 32-bit version of Python on a amd64 bit machine, this is how you do it on a Debian/Ubuntu system.
Firstly you need the correct compiler stuff, this means you need gcc-multilib and 32-bit development libraries of at least libc. On …
While GNU sed takes care not to munge NULL characters this is not the POSIX standard, therefore it's no surprise some implementations don't manage to edit binary files properly (not to mention that many implementations will struggle with long lines). Hence the search for a binary sed:
bbe is just …
When you create a shared object that depends on another shared object there are multiple ways to tell it where to look for the shared object. Two of these are by encoding (at linking time) a DT_RPATH and DT_RUNPATH entry in the .dynamic section. A third one is to use …
Why can C developers be happy with using config.h to get constants about where to look for configuration or data files for example, yet Python developers seem to refuse to think of any way they might want to support finding these files in a portable way?
Virtualbox is my desktop virtualisation technology of choice most of the time and I wanted to have a play with FreeBSD. Seems they don't get along tough and you won't get a network connection.
There exists a datetime.datetime.fromtimestamp() and many a time I've wondered why there is no .totimestamp() equivalent. The answer is that not all datetime objects can be represented by a timestamp. But if you know this restriction and want it anyway, this is the magic:
time.mktime(datetime_object.timetuple …
Most UNIX-like systems have information about processes stored in /proc/$pid/ files, so does Linux.
If you would want to get the Resident Set Size (RSS) of a process on Linux you could find this in a number of files: